Sahih al Bukhari 1057
Eclipses
حَدَّثَنَا مُسَدَّدٌ، قَالَ حَدَّثَنَا يَحْيَى، عَنْ إِسْمَاعِيلَ، قَالَ حَدَّثَنِي قَيْسٌ، عَنْ أَبِي مَسْعُودٍ، قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم " الشَّمْسُ وَالْقَمَرُ لاَ يَنْكَسِفَانِ لِمَوْتِ أَحَدٍ وَلاَ لِحَيَاتِهِ، وَلَكِنَّهُمَا آيَتَانِ مِنْ آيَاتِ اللَّهِ، فَإِذَا رَأَيْتُمُوهُمَا فَصَلُّوا ".
Narrated Abu Mas`ud:Allah's Messenger (ﷺ) said, "The sun and the moon do not eclipse because of someone's death or life but they are two signs amongst the signs of Allah, so pray whenever you see them
Text from the public-domain hadith-api dataset. Numbering follows that dataset and can differ by a few from some printed editions — check the wording, not only the number.