(19) باب السَّهْوِ فِي الصَّلاَةِ وَالسُّجُودِ لَهُ
Abu Sa'id al-Khudri reported:
The Messenger of Allah (ﷺ) 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.
Reference: Sahih Muslim 571 a
In-book reference: Book 5, Hadith 110
USC-MSA web (English) reference(deprecated numbering scheme): Book 4, Hadith 1166