Hadithcore
Sahih Muslim, 438 b
sahih

Abu Sa'id al-Khudri reported:

The Messenger of Allah (ﷺ) saw people at the end of the mosque, and then the (above-mentioned hadith) was narrated.

حَدَّثَنَا عَبْدُ اللَّهِ بْنُ عَبْدِ الرَّحْمَنِ الدَّارِمِيُّ، حَدَّثَنَا مُحَمَّدُ بْنُ عَبْدِ اللَّهِ الرَّقَاشِيُّ، حَدَّثَنَا بِشْرُ بْنُ مَنْصُورٍ، عَنِ الْجُرَيْرِيِّ، عَنْ أَبِي نَضْرَةَ، عَنْ أَبِي سَعِيدٍ الْخُدْرِيِّ، قَالَ رَأَى رَسُولُ اللَّهِ صلى الله عليه وسلم قَوْمًا فِي مُؤَخَّرِ الْمَسْجِدِ ‏.‏ فَذَكَرَ مِثْلَهُ ‏.‏

References2 variants
In-Book Reference
Book 4, Hadith 145
USC-MSA web (English) reference
Book 4, Hadith 879 (deprecated numbering scheme)