When the Prophet ﷺ would place the deceased in the grave, he would say, "In the name of Allah, and upon the way of the Messenger of Allah."In another narration, "And upon the religion of the Messenger of Allah."
أن النبي ﷺ كان إذا وضع الميت في القبر قال: بسم الله، وعلى سنة رسول الله. وفي رواية: وعلى ملة رسول الله.
Abu Dawud (3213), Ahmad (4812), and Nasai in Al-Kubra (10927) narrated it, and Ibn Hibban (3110) and Hakim (1/366) graded it sahih, all of them through the route of Hammam bin Yahya, from Qatada, from Abu Siddiq, who is Naji, from Ibn Umar, and he mentioned it, with the wording belonging to Abu Dawud. Its chain is sahih, and Abu Siddiq is Bakr bin Amr, who is trustworthy.Tirmidhi (1046) and Ibn Majah (1550) both narrated it through the route of Abu Khalid Ahmar, from Hajjaj, from Nafi, from Ibn Umar, with the wording, "In the name of Allah, by Allah, and upon the religion of the Messenger of Allah," and in another narration, "upon the sunnah of the Messenger of Allah."The discussion of this is treated at length in the Book of Funerals.