It is narrated from Sayyiduna Abdullah bin Mas'ud (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: "I am only a human being; I forget just as you forget. So when any of you has a doubt in his prayer, let him reflect and complete his prayer on what is closest to being correct, and then (at the end) perform two prostrations."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 3797