كتاب الْمَسَاجِدِ وَمَوَاضِعِ الصَّلاَةِ
5  
The Book of Mosques and Places of Prayer
(19)
Chapter: As-Sahw (forgetfulness) in prayer and prostrating to compensate for it
(19)
باب السَّهْوِ فِي الصَّلاَةِ وَالسُّجُودِ لَهُ ‏
Sahih Muslim 572 j

Ibrahim b. Suwaid-reported:

'Alqama led us in the noon prayer and be offered five rak'ahs; when the prayer was complete, the people said to him: Abu Shibl, you have offered five rak'ahs. He said: No, I have not done that. They said: Yes (you said five rak'ahs). He (the narrator) said: And I was sitting in a corner among people and I was just a boy. I (also) said: Yes, you have offered five (rak'ahs). He said to me: O, one-eyed, do you say the same thing? I said: Yes. Upon this he turned (his face) and performed two prostrations and then gave salutations, and then reported 'Abdullah as saying: The Messenger of Allah (ﷺ) led us in prayer and offered five rak'ahs. And as he turned away the people began to whisper amongst themselves. He (the Holy Prophet) said: What is the matter with you? They said: Has the prayer been extended? He said: No. They said: You have in fact said five rak'ahs. He (the Holy Prophet) then turned his back (and faced the Qibla) and performed two prostrations and then gave salutations and further said: Verily I am a human being like you, I forget just as you forget. Ibn Numair made this addition:" When any one of you forgets, he must perform two prostrations."
حَدَّثَنَا عُثْمَانُ بْنُ أَبِي شَيْبَةَ، - وَاللَّفْظُ لَهُ - حَدَّثَنَا جَرِيرٌ، عَنِ الْحَسَنِ بْنِ عُبَيْدِ اللَّهِ، عَنْ إِبْرَاهِيمَ بْنِ سُوَيْدٍ، قَالَ صَلَّى بِنَا عَلْقَمَةُ الظُّهْرَ خَمْسًا فَلَمَّا سَلَّمَ قَالَ الْقَوْمُ يَا أَبَا شِبْلٍ قَدْ صَلَّيْتَ خَمْسًا ‏.‏ قَالَ كَلاَّ مَا فَعَلْتُ ‏.‏ قَالُوا بَلَى - قَالَ - وَكُنْتُ فِي نَاحِيَةِ الْقَوْمِ وَأَنَا غُلاَمٌ فَقُلْتُ بَلَى قَدْ صَلَّيْتَ خَمْسًا ‏.‏ قَالَ لِي وَأَنْتَ أَيْضًا يَا أَعْوَرُ تَقُولُ ذَاكَ قَالَ قُلْتُ نَعَمْ ‏.‏ قَالَ فَانْفَتَلَ فَسَجَدَ سَجْدَتَيْنِ ثُمَّ سَلَّمَ ثُمَّ قَالَ قَالَ عَبْدُ اللَّهِ صَلَّى بِنَا رَسُولُ اللَّهِ صلى الله عليه وسلم خَمْسًا فَلَمَّا انْفَتَلَ تَوَشْوَشَ الْقَوْمُ بَيْنَهُمْ فَقَالَ ‏"‏ مَا شَأْنُكُمْ ‏"‏ ‏.‏ قَالُوا يَا رَسُولَ اللَّهِ هَلْ زِيدَ فِي الصَّلاَةِ قَالَ ‏"‏ لاَ ‏"‏ ‏.‏ قَالُوا فَإِنَّكَ قَدْ صَلَّيْتَ خَمْسًا ‏.‏ فَانْفَتَلَ ثُمَّ سَجَدَ سَجْدَتَيْنِ ثُمَّ سَلَّمَ ثُمَّ قَالَ ‏"‏ إِنَّمَا أَنَا بَشَرٌ مِثْلُكُمْ أَنْسَى كَمَا تَنْسَوْنَ ‏"‏ ‏.‏ وَزَادَ ابْنُ نُمَيْرٍ فِي حَدِيثِهِ ‏"‏ فَإِذَا نَسِيَ أَحَدُكُمْ فَلْيَسْجُدْ سَجْدَتَيْنِ ‏"‏ ‏.‏
Reference : Sahih Muslim 572j
In-book reference : Book 5, Hadith 121
USC-MSA web (English) reference : Book 4, Hadith 1177
  (deprecated numbering scheme)