Narrated by AbuSa’id al-Khudri(Radhiallaho anho):
Allah’s Messenger (sallAllaahu ‘alaihi wasallam) said:
When any one of you is in doubt about his prayer and he does not 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.
Sahih Muslim Number 1166