عَنْ أَبِي سَعِيدٍ الْخُدْرِيِّ رضي الله عنه قَالَ: قَالَ رَسُولُ اللهِ صَلَّى اللهُ عَلَيْهِ وَسَلَّمَ: «إِذَا شَكَّ أَحَدُكُمْ فِي صَلَاتِهِ، فَلَمْ يَدْرِ كَمْ صَلَّى ثَلَاثًا أَمْ أَرْبَعًا، فَلْيَطْرَحِ الشَّكَّ، وَلْيَبْنِ عَلَى مَا اسْتَيْقَنَ، ثُمَّ يَسْجُدُ سَجْدَتَيْنِ قَبْلَ أَنْ يُسَلِّمَ، فَإِنْ كَانَ صَلَّى خَمْسًا شَفَعْنَ لَهُ صَلَاتَهُ، وَإِنْ كَانَ صَلَّى إِتْمَامًا لِأَرْبَعٍ كَانَتَا تَرْغِيمًا لِلشَّيْطَانِ».
The Prophet (may Allah's peace and blessings be upon him) clarified that if the person praying is in doubt about his prayer, not knowing how much he prayed, three or four, let him exclude the extra number that he doubts and not take it into account, so three is the number he is certain about, and let him perform a fourth Rak'ah, then offer two prostrations before making Taslīm (salutation of peace ending the prayer).
If he has actually offered four Rak‘ahs, they will become five by adding a Rak‘ah, and the two prostrations of forgetfulness stand for one Rak‘ah, so the total will be even, not odd. On the other hand, if he has prayed four in total with the extra Rak‘ah, then he has performed what is due on him without any increase or decrease.
In this case, the two prostrations of forgetfulness will bring humiliation and defeat to the devil and will drive him away from fulfilling his goal because he threw him into confusion regarding his prayer and tried to spoil it. However, man's prayer became complete when he obeyed Allah Almighty through prostration, which was the same act through which Satan disobeyed Allah when he refused to obey Him by prostrating to Adam.
Download for free and never miss a prayer again