[Machine] On the authority of the Prophet ﷺ, he said: If one of you has doubt during prayer and does not know whether they have prayed three or four (units), then they should get up and perform one unit of prayer (rakah). He said: Increase (the number of units of prayer) until the doubt is in the increase. Then, they should prostrate for the two prostrations of forgetfulness. If they prayed five (units of prayer), it will make up for their prayer. And if they prayed four, they will be compelled by the Satan.
عَنِ النَّبِيِّ ﷺ قَالَ إِذَا شَكَّ أَحَدُكُمْ فِي الصَّلَاةِ فَلَمْ يَدْرِ ثَلَاثًا صَلَّى أَمْ أَرْبَعًا فَلْيَقُمْ فَلْيُصَلِّ رَكْعَةً قَالَ يَزِيدُ حَتَّى يَكُونَ الشَّكُّ فِي الزِّيَادَةِ ثُمَّ لِيَسْجُدْ سَجْدَتَيِ السَّهْوِ فَإِنْ كَانَ صَلَّى خَمْسًا شَفَعَتَا لَهُ صَلَاتَهُ وَإِنْ كَانَ صَلَّى أَرْبَعًا فَهُمَا يُرْغِمَانِ الشَّيْطَانَ