Sayyiduna Abdullah bin Mas'ud (may Allah be pleased with him) narrates: When we used to pray, we did not know what we should say. We used to say: As-salamu 'ala Allah, as-salamu 'ala Jibra'il, as-salamu 'ala Mika'il, as-salamu 'ala an-nabiyyin (Peace be upon Allah, peace be upon Jibra'il, peace be upon Mika'il, peace be upon the prophets). Then the Messenger of Allah (peace and blessings be upon him), teaching us the salam, said: "Indeed, Allah Himself is al-Salam (Peace). So when you pray, say: 'At-tahiyyatu lillahi was-salawatu wat-tayyibat, as-salamu 'alayka ayyuha an-Nabiyyu wa rahmatullahi wa barakatuh, as-salamu 'alayna wa 'ala 'ibadillahi as-salihin' (All verbal, physical and financial acts of worship are for Allah. Peace be upon you, O Prophet, and the mercy of Allah and His blessings. Peace be upon us and upon all the righteous)."
Abu Wa'il (may Allah have mercy on him), in his narration through Abdullah (may Allah be pleased with him), reports that he (peace and blessings be upon him) said: "When you say this, the greeting of peace reaches every angel brought near and every messenger, and every righteous servant as well. 'Ashhadu an la ilaha illallah wa ashhadu anna Muhammadan 'abduhu wa rasuluh' (I bear witness that there is no god but Allah, and I bear witness that Muhammad (peace and blessings be upon him) is the servant of Allah and His Messenger)."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 3960