The Prophet (ﷺ) said: "If one of you does not know whether he prayed three or four (rak'ahs), let him pray a rak'ah then prostrate twice after that when he is sitting. Then if he 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 1239 In-book : Book 13, Hadith 61 English translation : Vol. 2, Book 13, Hadith 1240
Help us gift a modern, ad-free Islamic application for the Muslim Ummah. Your donation will be recorded as Sadaqah Jariyah in your book of deeds, In Sha Allah.