Abdullah bin Umar reported,

The Messenger of Allah ﷺ said, "When one of you prays and does not know how many units he has prayed, three or four, let him perform one more unit, doing its bowing and prostration well, and then perform two prostrations."

Azami 2473

Sahih

عن ابن عمر قال

قال رسول الله ﷺ: إذا صلى أحدكم فلا يدري كم صلى، ثلاثا أو أربعا، فليركع ركعة، يحسن ركوعها وسجودها، ويسجد سجدتين.

الأعظمي 2473صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Prayer
Chapter
Forgetfulness
Section
Two prostrations for forgetfulness and building upon certainty
Numbering
Jami al-Kamil 2473 (2nd edition)
Azami 2473