The Messenger of Allah ﷺ said, "When the deceased is buried," or he said, "when one of you is buried, two black-blue angels come to him. One is called Munkar and the other Nakir. They ask him, 'What did you used to say about this man?'He replies with what he used to say, 'He is the servant of Allah and His Messenger. I bear witness that there is no god but Allah and that Muhammad is His servant and Messenger.'They say, 'We knew that you would say this.'Then his grave is expanded for him to seventy cubits by seventy, and it is illuminated for him. Then he is told, 'Sleep.'He says, 'Let me return to my family to tell them.'They say, 'Sleep like the sleep of a bridegroom whom none but the dearest of his family wakes,' until Allah resurrects him from that resting place.But if he is a hypocrite, he says, 'I heard people saying something, so I said the same. I do not know.'They say, 'We knew that you would say that.'Then it is said to the earth, 'Close in upon him,' and it closes in upon him until his ribs interlock. He remains tormented within it until Allah resurrects him from that resting place."
حدثنا أبو سلمة يحيى بن خلف البصري حدثنا بشر بن المفضل عن عبد الرحمن بن إسحق عن سعيد بن أبي سعيد المقبري
قال رسول الله ﷺ إذا قبر الميت أو قال أحدكم أتاه ملكان أسودان أزرقان يقال لأحدهما المنكر والآخر النكير فيقولان ما كنت تقول في هذا الرجل فيقول ما كان يقول هو عبد الله ورسوله أشهد أن لا إله إلا الله وأن محمدا عبده ورسوله فيقولان قد كنا نعلم أنك تقول هذا ثم يفسح له في قبره سبعون ذراعا في سبعين ثم ينور له فيه ثم يقال له نم فيقول أرجع إلى أهلي فأخبرهم فيقولان نم كنومة العروس الذي لا يوقظه إلا أحب أهله إليه حتى يبعثه الله من مضجعه ذلك وإن كان منافقا قال سمعت الناس يقولون فقلت مثله لا أدري فيقولان قد كنا نعلم أنك تقول ذلك فيقال للأرض التئمي عليه فتلتئم عليه فتختلف فيها أضلاعه فلا يزال فيها معذبا حتى يبعثه الله من مضجعه ذلك
[Its chain is hasan] Bayhaqi also reported it in Ithbat Azab Qabr, no. 55, 54 (in my edition) from the hadith of Abdul-Rahman bin Ishaq Madani, with the same wording, and Ibn Hibban graded it sahih (al-Ihsan): 3107.There are also narrations on this topic from Ali, coming up at 3520, and Zayd bin Thabit [Muslim, no. 2867], and Ibn Abbas [previously mentioned at 70], and Bara bin Azib [Bukhari, no. 1369, and Muslim, no. 2871], and Abu Ayub [Muslim, no. 2869], and Anas [Bukhari, no. 1374, and Muslim, no. 2868], and Jabir [Bukhari in Adab al-Mufrad, no. 735], and Ayesha [Bukhari, nos. 1371, 1372, and Muslim, no. 932], and Abu Saeed [Ahmad: 3/38, and Bayhaqi in Ithbat Azab Qabr, no. 57].