Sayyiduna Abd al-Rahman bin Awf (may Allah be pleased with him) said: I heard the Messenger of Allah (peace and blessings be upon him) say: "When any of you is in doubt in his prayer: if he is in doubt between one and two, let him count it as one; if he is in doubt between two and three, let him count them as two; and if he is in doubt between three and four, let him consider them three, so that the uncertainty falls on an addition. Then let him perform two prostrations before the salam, and then give the salam."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 3827