(24) باب إِتْمَامِ الْمُصَلِّي عَلَى مَا ذَكَرَ إِذَا شَكَّ
It was narrated from Abu Sa'eed that:
The Prophet (ﷺ) said: "If one of you is not sure about his prayer, let him forget about what he is unsure of and complete his prayer on the basis of what he is sure of. When he is sure that he has completed it, let him prostrate twice while he is sitting. Then if he has prayed five (rak'ahs), they (the two prostrations) will make his prayer even-numbered, and if he had prayed four, they will annoy and humiliate the shaitan."
Reference: Sunan an-Nasa'i 1238
In-book reference: Book 13, Hadith 60
English translation: Vol. 2, Book 13, Hadith 1239