It is narrated from Sayyiduna Abdullah bin Ja'far (may Allah be pleased with them both) that the Prophet (peace and blessings be upon him) said: "Whoever has a doubt about anything in his prayer, let him perform two prostrations before he gives the salam."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 13805