Narrated Abu Musa:
The sun eclipsed and the Prophet (ﷺ) got up, being afraid that it might be the Hour (i.e. Day of Judgment). He went to the Mosque and offered the prayer with the longest Qiyam, bowing and prostration that I had ever seen him doing. Then he said, "These signs which Allah sends do not occur because of the life or death of somebody, but Allah makes His worshipers afraid by them. So when you see anything thereof, proceed to remember Allah, invoke Him and ask for His forgiveness."
Narrated Abu Bakra:
In the lifetime of the Allah's Messenger (p.b.u.h) the sun eclipsed and he went out dragging his clothes till he reached the Mosque. The people gathered around him and he led them and offered two rak`at. When the sun (eclipse) cleared, he said, "The sun and the moon are two signs amongst the signs of Allah; they do not eclipse because of the death of someone, and so when an eclipse occurs, pray and invoke Allah till the eclipse is over." It happened that a son of the Prophet (ﷺ) called Ibrahim died on that day and the people were talking about that (saying that the eclipse was caused by his death).
Narrated Abu Bakra:
We were with Allah's Messenger (ﷺ) when the sun eclipsed. Allah's Messenger (ﷺ) stood up dragging his cloak till he entered the Mosque. He led us in a two-rak`at prayer till the sun (eclipse) had cleared. Then the Prophet (p.b.u.h) said, "The sun and the moon do not eclipse because of someone's death. So whenever you see these eclipses pray and invoke (Allah) till the eclipse is over."
Narrated Abu Bakra:
Allah's Messenger (ﷺ) said: "The sun and the moon are two signs amongst the signs of Allah and they do not eclipse because of the death of someone but Allah frightens His devotees with them."