The Prophet ﷺ said concerning the verse "Allah keeps firm those who believe with the firm word", "This was revealed about the punishment of the grave. He is asked, 'Who is your Lord?' and he answers, 'My Lord is Allah and my prophet is Muhammad ﷺ.' That is the meaning of His words , 'Allah keeps firm those who believe with the firm word in this worldly life and in the Hereafter' [Ibrahim 14:27]."Another wording has it, "When the believer is seated in his grave, he is approached, and he then testifies that there is no god but Allah and that Muhammad is the Messenger of Allah. That is the meaning of His words, 'Allah keeps firm those who believe with the firm word' [Ibrahim 14:27]."
عن النبي ﷺ قال: {يثبت الله الذين ءامنوا بالقول الثابت} قال: نزلت في عذاب القبر، فيقال له: من ربك؟ فيقول: ربي الله ونبيي محمد ﷺ، فذلك قوله عز وجل: {يثبت الله الذين امنوا بالقول الثابت في الحيوة الدنيا وفي الآخرة}. وفي لفظ: إذا أقعد المؤمن في قبره أتي، ثم شهد أن لا إله إلا الله وأن محمدا رسول الله فذلك قوله: {يثبت الله الذين آمنوا بالقول الثابت}
Bukhari related it in the Book of Funerals (1369), and Muslim in the Book of Paradise, its Bliss, and its People (2871), both by way of Shuba, from Alqama bin Marthad, from Saad bin Ubayda, from Bara bin Azib, and he narrated it. The first wording is Muslim's, and the second is Bukhari's. The rest of the hadiths on the punishment and bliss of the grave are mentioned in the Book of Funerals.