Sahih al-Bukhari, Volume 7, Book 72, Hadith 676 (USC-MSA) ⓘ
Narrated Abu Bakra: The solar eclipse occurred while we were sitting with the Prophet He got up dragging his garment (on the ground) hurriedly till he reached the mosque The people turned (to the mosque) and he offered a two-rak`at prayer whereupon the eclipse was over and he traced us and said, "The sun and the moon are two signs among the signs of Allah, so if you see a thing like this (eclipse) then offer the prayer and invoke Allah till He remove that state."
حَدَّثَنِي مُحَمَّدٌ، أَخْبَرَنَا عَبْدُ الأَعْلَى، عَنْ يُونُسَ، عَنِ الْحَسَنِ، عَنْ أَبِي بَكْرَةَ ـ رضى الله عنه ـ قَالَ خَسَفَتِ الشَّمْسُ وَنَحْنُ عِنْدَ النَّبِيِّ صلى الله عليه وسلم فَقَامَ يَجُرُّ ثَوْبَهُ مُسْتَعْجِلاً، حَتَّى أَتَى الْمَسْجِدَ وَثَابَ النَّاسُ فَصَلَّى رَكْعَتَيْنِ، فَجُلِّيَ عَنْهَا، ثُمَّ أَقْبَلَ عَلَيْنَا وَقَالَ " إِنَّ الشَّمْسَ وَالْقَمَرَ آيَتَانِ مِنْ آيَاتِ اللَّهِ، فَإِذَا رَأَيْتُمْ مِنْهَا شَيْئًا فَصَلُّوا وَادْعُوا اللَّهَ حَتَّى يَكْشِفَهَا " .
also referenced under: Book 77, Hadith 3 (In-Book) & Hadith 5785 (DarusSalam)