It is narrated from Sayyiduna Abu Hurairah (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: "When you hear the crowing of roosters at night, then ask Allah for His bounty, for they have seen an angel. And when you hear the braying of donkeys at night, then seek refuge with Allah from Satan, for they have seen a devil."
Hadith Referenceالادب المفرد / كتاب البهائم / 1236
Hadith Gradingالألبانی:صحيح
Hadith Takhrij«صحيح : أخرجه البخاري ، كتاب بدء الخلق : 3303 و مسلم : 2729 و أبوداؤد : 5102 و الترمذي : 3459 و النسائي فى الكبريٰ : 10713»
Explanation & Benefits
Shaykh Maulana Usman Muneeb
Benefits and Issues: Qadi Iyad rahimahullah has written that the command to supplicate upon hearing the crowing of a rooster is so that the angels may say "Ameen" to his supplication and seek forgiveness from Allah Ta'ala for that servant. Furthermore, it is understood that this is also specific to the nighttime, because the general statement will be interpreted in light of the specific one.
Source: Fadlullah al-Ahad: Urdu Commentary on al-Adab al-Mufrad, Page: 1236