Answered by Shaykh Hamza Karamali, SunniPath Academy Teacher
Is it permissible to suffice with the forgetfulness prostrations when one forgets how many rakaats they have performed in prayer or does the prayer itself have to be repeated?
In the Name of Allah, Most Merciful and Compassionate
wa `alaykum as salam wa rahmatullah wa barakatuh
Forgetting the number of rak`ahs that one has prayed does not automatically invalidate one’s prayer.
Rather, if one forgets how many rak`ahs one has prayed, one goes on the assumption that he has prayed the least number that he is certain of. For example, if I’m unsure whether I’ve prayed two or three rak`ahs, then I assume that I’ve only prayed two and then complete my prayer based on that assumption.
If one’s doubt persists until the end of the prayer, then it would be recommended (but not obligatory) to perform two prostrations of forgetfulness at the end of the prayer.
If one remembers the correct number of rak`ahs before the end of the prayer, then in certain cases, it would be recommended to perform the forgetfulness prostration whereas in other cases it would be forbidden to perform it. Because the rulings can get a bit complicated here, I would suggest that you not perform the forgetfulness prostration in this case unless you are sure that you understand exactly when it is recommended to perform it.
And Allah knows best.