Sunan Abi Dawud 1026
سنن أبي داود#1026SahihNarrated Ata' ibn Yasar: The Prophet (ﷺ) said: When one of you is in doubt about his prayer, and does not know how much he has prayed, three or four rak'ahs, he should pray one (additional) rak'ah and make two prostrations while sitting before giving the salutation. If the (additional) rak'ah which he prayed is the fifth one, he will make it an even number by these two prostrations. If it is the fourth one, the two prostrations will be a disgrace for the devil
Scholarly Authentication
We show the most cautious grade (weakest-wins) as the overall label. Individual scholars graded it as follows:
Al-AlbaniSahih
Muhammad Muhyi Al-Din Abdul HamidSahih
Zubair Ali ZaiSahih
In-book reference: 2:637