Forgetting the Number of Rak`ahs while Praying
What is the ruling of forgetting the number of rak`ahs (unit of prayer) while making sujud (prostration) in my prayer?
In the name of Allah, we praise Him, seek His help and ask for His forgiveness. Whoever Allah guides none can misguide, and whoever He allows to fall astray, none can guide them aright.
First of all, you have to know that forgetting the number of rak`ahs that you have prayed does not invalidate your prayer.
Rather, if you forget how many rak`ahs you have prayed, you go on the assumption that you have prayed the least number that you are certain of. For example, if I am unsure whether I have prayed two or three rak`ahs, then I assume that I have only prayed two and then complete my prayer based on that assumption.
At the end of prayer and before making tasleem, it is recommended (but not obligatory) to perform two prostrations of forgetfulness.
To know more about the ruling of forgetting the number of rak`ahs while offering prayer, watch this interesting talk with Dr. Muhammad Salah.
Source: Huda Youtube Channel.