Al-Adab Al-Mufrad, Book 51, Hadith 1236 (In-Book) ⓘ
Abu Hurayra reported that the Messenger of Allah, may Allah bless him and grant him peace, said, "When you hear the crowing of a cock in the night, it has seen an angel. Ask Allah for its blessing. If you hear the braying of a donkey in the night, it has seen a shaytan, so seek refuge with Allah from shaytan."
حَدَّثَنَا عَبْدُ اللهِ بْنُ صَالِحٍ قَالَ: حَدَّثَنِي اللَّيْثُ قَالَ: حَدَّثَنِي جَعْفَرُ بْنُ رَبِيعَةَ، عَنْ عَبْدِ الرَّحْمَنِ بْنِ هُرْمُزَ، عَنْ أَبِي هُرَيْرَةَ، عَنْ رَسُولِ اللهِ صلى الله عليه وسلم أَنَّهُ قَالَ: إِذَا سَمِعْتُمْ صِيَاحَ الدِّيَكَةِ مِنَ اللَّيْلِ، فَإِنَّهَا رَأَتْ مَلَكًا، فَسَلُوا اللَّهَ مِنْ فَضْلِهِ، وَإِذَا سَمِعْتُمْ نُهَاقَ الْحَمِيرِ مِنَ اللَّيْلِ، فَإِنَّهَا رَأَتْ شَيْطَانًا، فَتَعَوَّذُوا بِاللَّهِ مِنَ الشَّيْطَانِ.
also referenced under: Hadith 1236 (Reference) & Book 51, Hadith 1236 (English)