Prayer (Kitab Al-Salat): Details of Commencing Prayer

Dawud :: Book 3 : Hadith 1021

Narrated Ata' ibn Yasar:

The Prophet (peace_be_upon_him) said: When one of you is in doubt about his prayer, and does not know how much he has prayed, three or four rak'ahs, he should pray one (additional) rak'ah and make two prostrations while sitting before giving the salutation. If the (additional) rak'ah which he prayed is the fifth one, he will make it an even number by these two prostrations. If it is the fourth one, the two prostrations will be a disgrace for the devil.

Source materials are from the University of Southern California MSA site
Hadith eBooks converted from Imaan Star