The sun was eclipsed during the lifetime of the Messenger of Allah ﷺ. He stood up and pronounced the takbir, and the people lined up in rows behind him. The Messenger of Allah ﷺ recited a long recitation, then said the takbir and bowed for a long time. He then raised his head and said, "Allah hears whoever praises Him. Our Lord, to You belongs all praise."He then stood again and recited another long recitation, shorter than the first, then said the takbir and bowed for a long time, but shorter than the first bowing. Then he said, "Allah hears whoever praises Him. Our Lord, to You belongs all praise."Then he prostrated. He did the same in the second cycle, completing four bowings and four prostrations. The sun had become clear again before he finished.He then stood and addressed the people. He praised Allah as He deserves to be praised, then said, "The sun and the moon are two of the signs of Allah, the Most High. They are not eclipsed for the death or birth of anyone. So when you see them eclipsed, pray until the eclipse is lifted from you."The Messenger of Allah ﷺ also said, "While standing in this place, I saw everything that you have been promised. You saw me try to reach for a cluster from Paradise when you saw me step forward. And I saw Hellfire, parts of it consuming other parts, when you saw me step back. I saw in it Ibn Luhayy, the one who instituted the practice of the sawaib."
أخبرنا محمد بن سلمة عن ابن وهب عن يونس عن ابن شهاب قال أخبرني عروة بن الزبير
خسفت الشمس في حياة رسول الله ﷺ فقام فكبر وصف الناس وراءه فاقترأ رسول الله ﷺ قراءة طويلة ثم كبر فركع ركوعا طويلا ثم رفع رأسه فقال سمع الله لمن حمده ربنا ولك الحمد ثم قام فاقترأ قراءة طويلة هي أدنى من القراءة الأولى ثم كبر فركع ركوعا طويلا هو أدنى من الركوع الأول ثم قال سمع الله لمن حمده ربنا ولك الحمد ثم سجد ثم فعل في الركعة الأخرى مثل ذلك فاستكمل أربع ركعات وأربع سجدات وانجلت الشمس قبل أن ينصرف ثم قام فخطب الناس فأثنى على الله عز وجل بما هو أهله ثم قال إن الشمس والقمر آيتان من آيات الله تعالى لا يخسفان لموت أحد ولا لحياته فإذا رأيتموهما فصلوا حتى يفرج عنكم وقال رسول الله ﷺ رأيت في مقامي هذا كل شيء وعدتم لقد رأيتموني أردت أن آخذ قطفا من الجنة حين رأيتموني جعلت أتقدم ولقد رأيت جهنم يحطم بعضها بعضا حين رأيتموني تأخرت ورأيت فيها ابن لحي وهو الذي سيب السوائب
Muslim reported it in the Book of Eclipse, chapter on the eclipse prayer, hadith 3/901, from Muhammad bin Salama, and Bukhari reported it in the Book of Eclipse, chapter on the imam's sermon during the eclipse, hadith 1046, from the hadith of Yunus Ayli, and it is in Kubra, hadith 1857.