The Messenger of Allah ﷺ said, "When you are present with a sick person or someone dying, speak words of goodness, for the angels say amen to what you say."She said, "When Abu Salama died, I went to the Prophet ﷺ and said, 'Messenger of Allah, Abu Salama has died.'"He replied, "Say, 'O Allah, forgive me and him, and grant me a good successor after him.'"
قال رسول الله ﷺ: إذا حضرتم المريض أو الميت، فقولوا خيرا، فإن الملائكة يؤمنون على ما تقولون قالت: فلما مات أبو سلمة أتيت النبي ﷺ فقلت: يا رسول الله إن أبا سلمة قد مات قال: قولي: اللهم اغفر لي وله، وأعقبني منه عقبى حسنة.
Muslim narrated it in the Book of Funerals (919) through several routes from Abu Muawiya, from Amash, from Shaqiq, from Umm Salama, and she related it. His saying, "and grant me in exchange for him a good succession," carries the meaning of "and give me instead something better than him," that is, a beautiful outcome.Tirmidhi (977) and Ibn Majah (1447) both narrated it through the route of Abu Muawiya with his chain of transmission. Tirmidhi said, "Hasan sahih. It used to be recommended that the dying person be prompted to say, 'There is no god but Allah.' Some scholars of knowledge said, if he says that once, then so long as he has not spoken afterward, he should not be prompted again, and it should not be repeated on him excessively."He also said, "It is reported from Ibn Mubarak that when death approached him, a man began prompting him, 'There is no god but Allah,' and repeated it on him excessively. Abdullah said to him, 'Once I have said it, I remain upon that so long as I have not spoken other words.' The meaning of Abdullah's statement is that he intended what was reported from the Prophet ﷺ, 'Whoever's last words are, "There is no god but Allah," enters Paradise.'" This is the end of Tirmidhi's statement.As for what is reported from Abu Saeed Khudri, as a raised hadith, "When you visit the sick person, give him hope of a longer life, for that does not change anything, but it comforts the soul of the sick person," this too is daif. Tirmidhi (2087) and Ibn Majah (1438) both narrated it from the hadith of Uqba bin Khalid Sakuni, from Musa bin Muhammad bin Ibrahim Taymi, from his father, from Abu Saeed, and he related it.In it is Musa bin Muhammad bin Ibrahim Taymi, Abu Muhammad Madani, about whom Bukhari said, "He has objectionable narrations." Abu Zura and Nasai said, "His hadith is objectionable." Daraqutni said, "Discarded." Other scholars of knowledge likewise graded him daif.Tirmidhi said, "A gharib hadith," meaning daif. Abdul-Rahman bin Abu Hatim said in Ilal (2/241), "I asked my father about hadiths narrated by Uqba bin Khalid, from Musa bin Muhammad bin Ibrahim Taymi, from his father, from Jabir, and from his father, from Abu Saeed, and from his father, from Anas, and so on." He mentioned among them the hadith of Abu Saeed cited above, and said, "These are objectionable hadiths, as though they were fabricated. Musa's hadith is extremely daif, and his father Muhammad bin Ibrahim never heard from Jabir nor from Abu Saeed."