The World Federation One Stop Fiqh

Ruling 1182

If in a two rakʿah recommended prayer one supposes that he has performed three rakʿahs or more, he must dismiss his doubt and his prayer is valid. However, if he supposes he has performed two rakʿahs or less, he must act according to that supposition based on obligatory precaution. For example, if he supposes that he has performed one rakʿah, he must as a precautionary measure perform another rakʿah.