The Messenger of Allah ﷺ came to us while we were gathered at Saad bin Ubada's place.Bashir bin Saad said to him, "Allah has commanded us to send blessings upon you, Messenger of Allah. How are we to do so?"The Messenger of Allah ﷺ remained silent for so long that we wished he had not been asked. Then he said, "Say, 'O Allah, send Your blessings upon Muhammad and the family of Muhammad, as You sent blessings upon Ibrahim. Bestow Your favor upon Muhammad and the family of Muhammad, as You bestowed Your favor upon the family of Ibrahim in all the worlds. Indeed, You are Praiseworthy, Glorious.' And the salutation is as you have already learned."
أتانا رسول الله ﷺ في مجلس سعد بن عبادة، فقال له بشير بن سعد: أمرنا الله أن نصلي عليك يا رسول الله، فكيف نصلي عليك؟ قال: فسكت رسول الله ﷺ حتى تمنينا أنه لم يسأله ثم قال: قولوا: اللهم صل على محمد وعلى آل محمد، كما صليت على إبراهيم، وبارك على محمد وعلى آل محمد كما باركت على آل إبراهيم في العالمين، إنك حميد مجيد، والسلام كما علمتم.
Malik narrated it in Qasr al-Salah (67) from Naeem bin Abdullah Mujmir, from Muhammad bin Abdullah bin Zayd, that he was informed by Abu Masud Ansari who mentioned it.Muslim narrated it in al-Salah (405) from Yahya bin Yahya, from Malik, with the same wording.Ibn Khuzayma (711) and others added, "How should we invoke blessings upon you when we invoke blessings upon you in our prayer?"