Whenever we prayed with the Prophet ﷺ, we used to say, "Peace be upon Allah before His servants, peace be upon Jibreel, peace be upon Mikail, peace be upon so-and-so and so-and-so."When the Prophet ﷺ finished the prayer, he turned his face toward us and said, "Indeed, Allah Himself is as-Salam. So when one of you sits during the prayer, let him say, 'All greetings, prayers, and good things belong to Allah. Peace be upon you, Prophet, and the mercy of Allah and His blessings. Peace be upon us and upon the righteous servants of Allah.' For when he says this, it reaches every righteous servant in the heavens and the earth. 'I bear witness that there is no god but Allah, and I bear witness that Muhammad is His servant and messenger.' Then after that, he may choose whatever words he wishes."
كنا إذا صلينا مع النبي ﷺ قلنا: السلام على الله قبل عباده، السلام على جبريل، السلام على ميكائيل، السلام على فلان وفلان، فلما انصرف النبي ﷺ أقبل علينا بوجهه، فقال: إن الله هو السلام، فإذا جلس أحدكم في الصلاة فليقل: التحيات لله، والصلوات، والطيبات، السلام عليك أيها النبي ورحمة الله وبركاته، السلام علينا وعلى عباد الله الصالحين، فإنه إذا قال ذلك أصاب كل عبد صالح في السماء والأرض، أشهد أن لا إله إلا الله، وأشهد أن محمدا عبده ورسوله، ثم يتخير بعد من الكلام ما شاء.
Bukhari narrated it in the Book of Seeking Permission (6230), and Muslim in the Book of Prayer (402), both through routes from Abu Waail Shaqiq, from Abdullah, who mentioned it. The wording given is Bukhari's.