كتاب المغازى
64
Military Expeditions led by the Prophet (pbuh) (Al-Maghaazi)
(83)
Chapter: The sickness of the Prophet (saws) and his death
(83)
بَابُ مَرَضِ النَّبِيِّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ وَوَفَاتِهِ
وَقَوْلِ اللَّهِ تَعَالَى: {إِنَّكَ مَيِّتٌ وَإِنَّهُمْ مَيِّتُونَ ثُمَّ إِنَّكُمْ يَوْمَ الْقِيَامَةِ عِنْدَ رَبِّكُمْ تَخْتَصِمُونَ}.

Narrated Anas bin Malik:

While the Muslims were offering the Fajr prayer on Monday and Abu Bakr was leading them in prayer, suddenly Allah's Messenger (ﷺ) lifted the curtain of `Aisha's dwelling and looked at them while they were in the rows of the prayers and smiled. Abu Bakr retreated to join the row, thinking that Allah's Apostle wanted to come out for the prayer. The Muslims were about to be put to trial in their prayer (i.e. were about to give up praying) because of being overjoyed at seeing Allah's Messenger (ﷺ). But Allah's Apostle beckoned them with his hand to complete their prayer and then entered the dwelling and let fall the curtain.

حَدَّثَنَا سَعِيدُ بْنُ عُفَيْرٍ، قَالَ حَدَّثَنِي اللَّيْثُ، قَالَ حَدَّثَنِي عُقَيْلٌ، عَنِ ابْنِ شِهَابٍ، قَالَ حَدَّثَنِي أَنَسُ بْنُ مَالِكٍ ـ رضى الله عنه ـ أَنَّ الْمُسْلِمِينَ، بَيْنَا هُمْ فِي صَلاَةِ الْفَجْرِ مِنْ يَوْمِ الاِثْنَيْنِ وَأَبُو بَكْرٍ يُصَلِّي لَهُمْ لَمْ يَفْجَأْهُمْ إِلاَّ رَسُولُ اللَّهِ صلى الله عليه وسلم قَدْ كَشَفَ سِتْرَ حُجْرَةِ عَائِشَةَ، فَنَظَرَ إِلَيْهِمْ وَهُمْ فِي صُفُوفِ الصَّلاَةِ‏.‏ ثُمَّ تَبَسَّمَ يَضْحَكُ، فَنَكَصَ أَبُو بَكْرٍ عَلَى عَقِبَيْهِ لِيَصِلَ الصَّفَّ، وَظَنَّ أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم يُرِيدُ أَنْ يَخْرُجَ إِلَى الصَّلاَةِ فَقَالَ أَنَسٌ وَهَمَّ الْمُسْلِمُونَ أَنْ يَفْتَتِنُوا فِي صَلاَتِهِمْ فَرَحًا بِرَسُولِ اللَّهِ صلى الله عليه وسلم فَأَشَارَ إِلَيْهِمْ بِيَدِهِ رَسُولُ اللَّهِ صلى الله عليه وسلم أَنْ أَتِمُّوا صَلاَتَكُمْ، ثُمَّ دَخَلَ الْحُجْرَةَ وَأَرْخَى السِّتْرَ‏.‏
Reference : Sahih al-Bukhari 4448
In-book reference : Book 64, Hadith 468
USC-MSA web (English) reference : Vol. 5, Book 59, Hadith 729
  (deprecated numbering scheme)