The Book of Prayers (Kitab Al-Salat)
Muslim :: Book 4 : Hadith 1166
Abu Sa'id al-Khudri reported: The Messenger of Allah (may peace be upon him) said: When any one of you is in doubt about his prayer and he does Dot know how much he has prayed, three or four (rak'ahs). he should cast aside his doubt and base his prayer on what he is sure of. then perform two prostrations before giving salutations. If he has prayed five rak'ahs, they will make his prayer an even number for him, and if he has prayed exactly four, they will be humiliation for the devil.