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: "When one of you has a doubt in an obligatory prayer, let him seek out (what is correct), then perform the two prostrations of forgetfulness (sahw)."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 9797