Sunan an-Nasa'i, Volume 2, Book 16, Hadith 1492 (DarusSalam)

It was narrated that Abu Bakrah said: "We were with the Messenger of Allah when the sun became eclipsed. The Messenger of Allah went out dragging his garment, until he came to the masjid, and the people gathered around him. He led us in praying two rak'ahs and when (the eclipse) ended he said: 'The sun and the moon are two of the signs of Allah (SWT) by means of which Allah (SWT), the Mighty and Sublime, strikes fear into His slaves. They do not become eclipsed for the death or birth of anyone. If you see that, then pray until Allah (SWT)r relieves you of fear.' That was because his son named Ibrahim had died, and the people suggested to him that (the eclipse) happened because of that."

أَخْبَرَنَا عِمْرَانُ بْنُ مُوسَى، قَالَ حَدَّثَنَا عَبْدُ الْوَارِثِ، قَالَ حَدَّثَنَا يُونُسُ، عَنِ الْحَسَنِ، عَنْ أَبِي بَكْرَةَ، قَالَ كُنَّا عِنْدَ رَسُولِ اللَّهِ صلى الله عليه وسلم فَانْكَسَفَتِ الشَّمْسُ فَخَرَجَ رَسُولُ اللَّهِ صلى الله عليه وسلم يَجُرُّ رِدَاءَهُ حَتَّى انْتَهَى إِلَى الْمَسْجِدِ وَثَابَ إِلَيْهِ النَّاسُ فَصَلَّى بِنَا رَكْعَتَيْنِ فَلَمَّا انْكَشَفَتِ الشَّمْسُ قَالَ ‏ "‏ إِنَّ الشَّمْسَ وَالْقَمَرَ آيَتَانِ مِنْ آيَاتِ اللَّهِ يُخَوِّفُ اللَّهُ عَزَّ وَجَلَّ بِهِمَا عِبَادَهُ وَإِنَّهُمَا لاَ يَخْسِفَانِ لِمَوْتِ أَحَدٍ وَلاَ لِحَيَاتِهِ فَإِذَا رَأَيْتُمْ ذَلِكَ فَصَلُّوا حَتَّى يُكْشَفَ مَا بِكُمْ ‏" ‏ ‏.‏ وَذَلِكَ أَنَّ ابْنًا لَهُ مَاتَ يُقَالُ لَهُ إِبْرَاهِيمُ فَقَالَ لَهُ نَاسٌ فِي ذَلِكَ ‏.‏

sunnah.com