We went out with the Messenger of Allah ﷺ to attend the funeral of a man from the Ansar. When we reached the grave, the niche had not yet been dug. The Messenger of Allah ﷺ sat down, and we sat around him so still it was as though birds were perched on our heads. In his hand was a stick with which he was poking the ground. Then he raised his head and said, "Seek refuge in Allah from the punishment of the grave," repeating it two or three times.He mentioned the hadith in its full length, and it will appear in the chapter on the affirmation of the punishment of the grave.
خرجنا مع رسول الله ﷺ في جنازة رجل من الأنصار، فانتهينا إلى القبر ولما يلحد، فجلس رسول الله ﷺ وجلسنا حوله كأنما على رؤوسنا الطير، وفي يده عود ينكت به في الأرض، فرفع رأسه فقال: استعيذوا بالله من عذاب القبر مرتين أو ثلاثا، وذكر الحديث بطوله وسيأتي في باب إثبات عذاب القبر.
Reported by Abu Dawud (3212), Nasai (2003), and Ibn Majah (1548), all of them through Minhal bin Amr, from Zazan, from Bara, who narrated it.It was also reported by Abu Dawud (4753) and Imam Ahmad (18534) in detail, see Ithbat Azab Qabr. Its isnad is sahih.It was also reported by Hakim (1/37–40), who said, "Sahih according to the criteria of the two Sheikhs."