Sahih Muslim
KITAB AL-SALAT*(THE BOOK OF PRAYERS)
Book 4, Number 1175:
'Abdullah (b. Mas’ud) reported: The Apostle of Allah (may peace be upon him) said five rak'ahs of the noon prayer and when he completed the prayer, It was said to him: Has there been (commanded) an addition In prayer? He said: What is it? They said: You have said five rak’ahs, so he performed two prostrations.
Book 4, Number 1176:
Alqama reported: He (the Holy Prophet) had led them five rak’ahs in prayer.
Book 4, Number 1177:
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 (may peace be upon him) 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."
Book 4, Number 1178:
'Abdullah (b. Mas'ud) reported:
The Messenger of Allah (may peace be upon him) led us five (rak’ahs in prayer). We said: Messenger of Allah, has the prayer been extended?
He said: What is the matter?
They said: You have said five (rak’ahs).
He (the Holy Prophet) said: Verily I am a human being like you. I remember as you remember and I forget just as you forget. He then performed two prostrations as (compensation of) forgetfulness.
Book 4, Number 1179:
'Abdullah (b. Mas’ud) reported:
The Messenger of Allah (may peace be upon him) said prayer and he omitted or committed (something).
Ibrahim (one of the narrators of this hadith) said: It is my doubt, and it was said: Messenger of Allah, has there been any addition to the prayer?
He (the Holy Prophet) said: Verily I am a human being like you. I forget just as you forget so when any one of you forgets, he must perform two prostrations, and he (the Holy Prophet) was sitting and then the Messenger of Allah (may peace be upon him) turned (his face towards the Qibla) and performed two prostrations.
Book 4, Number 1180:
'Abdullah b. Mas’ud reported:
The Apostle of Allah (may peace be upon him) performed two prostrations for forgetfulness after salutation and talking.
Book 4, Number 1181:Abdullah reported: We prayed along with the Messenger of Allah (may peace he upon him) and he committed or omitted (something). Ibrahim said: By Allah, this is a misgiving of mine only. We said: Messenger of Allah, is there something new about the prayer ?
He (the Holy Prophet) said: No. We told him about what he had done.
He (the Holy Prophet) said : When a man commits or omits (something in prayer), he should perform two prostrations, and he then himself performed two prostrations.
Book 4, Number 1182:
Ibn Sirin reported Abu Huraira as saying:
The Messenger of Allah (may peace be upon him) led us in one of the two evening prayers, Zuhr or 'Asr, and gave salutations after two rak'ahs and going towards a piece of wood which was placed to the direction of the Qibla in the mosque, leaned on it looking as if he were angry.
Abu Bakr and Umar were among the people and they were too afraid to speak to him and the people came out in haste (saying) : The prayer has been shortened.
But among them was a man called Dhu'I-Yadain who said:
Messenger of Allah, has the prayer been shortened or have you forgotten ?
The Apostle of Allah (may peace be upon him) looked to the right and left and said: What was Dhu'I-Yadain saying?
They said: He is right. You (the Holy Prophet) offered but two rak'ahs.
He offered two (more) rak’ahs and gave salutation, then said takbir and prostrated and lifted (his head) and then said takbir and prostrated, then said takbir and lifted (his head).
He (the narrator) says: It has been reported to me by Imran b. Husain that he said :
He (their) gave salutation.
Book 4, Number 1183:
Abu Huraira reported :
The Messenger of Allah (may peace be upon him) led us in one of the evening prayers. (And this hadith was narrated like one transmitted by Sufyan).
Book 4, Number 1184:
Abu Huraira reported: The Messenger of Allah (may peace be upon him) led us in the 'Asr prayer and gave salutation after two rak'ahs.
Dhu'l-Yadain (the possessor of long arms) stood up and said: Messenger of Allah, has the prayer been shortened or have you forgotten ?
The Messenger of Allah (may peace be upon him) said: Nothing like this has happened (neither the prayer has been shortened nor have I forgotten).
He (Dhu'l-Yadain) said: Messenger of Allah, something has definitely happened.
The Messenger of Allah (may peace be upon him) turned towards people and said: Is Dhu'l-Yadain true (in his assertion) ?
They said : Messenger of Allah, he is true.
Then the Messenger of Allah (may peace be upon him) completed the rest of the prayer. and then performed two prostrations while he was sitting after salutation.
http://www.iium.edu.my/deed/hadith/muslim/004a_smt.html
It was narrated that Abu Sa’eed Al-Khudri (RA) said:
Allah’s Messenger (PBUH) said, “If one of you is unsure when in prayer and does not know how many (raka’at) he has prayed, whether it is three or four, let him ignore what is uncertain and proceed on the basis of what is certain. Then let him prostrate twice before saying the*Taslim.
Then if he has prayed five (raka’at) that will make his prayer even; and if he has prayed it properly with four (raka’at), it will annoy theShaitan.”
(Hadith No. 1272 (571), Chapters on Masajid & Places of Prayer, Sahih Muslim, Vol. 2; Hadith No. 1204, Book of Salat, Sunan Abu Dawud, Vol. 1)
Doubt is to be uncertain about which of the two matters has occurred, and doubt is not taken notice of in matters of worship in three cases:If it is just a self-delusion, having no reality like devilish whisperings.
If it occurs very frequently to a person such that he does not perform any act of worship except that he is caused to doubt in it.
If it occurs after the completion of the acts of worship, then it is not taken into account, as long as he is not certain of it, in which case he will need to act upon what he is certain of.
An example of this is that a person prays*Dhuhr, and after finishing his prayer he doubts whether he prayed three or four*raka'at. Then he takes no notice of this doubt unless he is certain that he only prayed three*raka'at, in which case he should complete his prayer if it occurs a short while later, then he should give the salutations, prostrate for forgetfulness and then perform the salutation again.
If however he does not remember until a long time has passed, then he must repeat the whole prayer afresh.
As for doubt in other than these three cases, then it is taken account of.
Doubt in the prayer will be of two kinds:
(i) That one of the two matters is more weighty in his mind, so he will act upon what is more weighty to him, then he will complete his prayer based upon that, after which he should give the salutation, prostrate for forgetfulness and finally give the salutation. An example of this is if a person prays*Dhuhrand doubts in a*rak'ah*(as to whether) it is the second or the third*rak'ah?
But the weightier case in his mind is that it is the third, so he makes it the third. So after he performs one further*rak'ah, he gives the salutation, prostrates for forgetfulness and the he gives the salutation.The proof for what is established in the*Sahihayn*(Al-Bukhari and Muslim) and elsewhere in the*hadith*of 'Abdullah ibn Mas'ud (may Allah be pleased with him) who said that the Prophet (may peace be upon him) said,*"If one of you doubts in his prayer, then let him strive to arrive at what is correct, and complete it upon that basis. Then let him give the salutation and perform two prostrations."This is the wording of al-Bukhari.
(ii) Neither of the two possibilities are weightier in his mind. Therefore, he should act upon that which he is certain of, which will be the lesser of the two, and complete his prayer based upon that, and then prostrate for forgetfulness before giving the salutation, and then give the salutation. An example of this is if a person is praying*'Asr*and doubts in a*rak'ah*(as to) whether it is the second or the third, and neither its being the second nor its being the third is more weighty in his mind. So he makes it the second, performs the first*Tashahud*and two*raka'at*after it, and then prostrates for forgetfulness and gives salutation.
The proof for this is what Muslim reports from Abu Sa'id al-Khudri (may Allah be pleased with him) that the Prophet (peace be upon him) said,*"If one of you doubts in his prayer and does not know how many he has prayed –whether it is three or four – then let him cast away the doubt and build upon what he is certain of. Then let him perform two prostrations before giving the salutation. So if he has prayed five, then they will make his prayer even for him, and if he has prayed the full four, then they will be a humiliation for Satan."
http://sunnahonline.com/library/fiqh-and-sunnah/320-prostration-of-forgetfulness-sajda-sahu-the