Abdullah bin Umar reported,

From the Prophet ﷺ. And Abdullah bin Saeed narrated to us, Abu Khalid al-Ahmar narrated to us, Hajjaj narrated to us, from Nafi, from Ibn Umar, who said, "When the Prophet ﷺ placed the deceased into the grave, he would say, 'In the name of Allah and upon the religion of the Messenger of Allah.'"Abu Khalid once said, "When the deceased was laid in the side-niche of the grave, he would say, 'In the name of Allah and upon the way of the Messenger of Allah.'"Hisham said in his version, "In the name of Allah, in the path of Allah, and upon the religion of the Messenger of Allah."

Ibn Majah 1550

Sahih

حدثنا هشام بن عمار حدثنا إسمعيل بن عياش حدثنا ليث بن أبي سليم عن نافع

عن ابن عمر

عن النبي ﷺ ح و حدثنا عبد الله بن سعيد حدثنا أبو خالد الأحمر حدثنا الحجاج عن نافع عن ابن عمر قال كان النبي ﷺ إذا أدخل الميت القبر قال بسم الله وعلى ملة رسول الله وقال أبو خالد مرة إذا وضع الميت في لحده قال بسم الله وعلى سنة رسول الله وقال هشام في حديثه بسم الله وفي سبيل الله وعلى ملة رسول الله

ابن ماجه 1550صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Ibn Majah
Book
Funerals
Chapter
Placing the deceased in the grave
Numbering
Darussalam 1550
Ibn Majah 1550