The Messenger of Allah ﷺ said to us, "When you are present with a sick or dying person, say good words, for the angels say amen to whatever you say."She said, when Abu Salama died, I came to the Prophet ﷺ and said, "Messenger of Allah, Abu Salama has died."He said, "Then say, 'O Allah, forgive me and him, and grant me a good successor in his place.'"She said, so I said it, and Allah granted me in his place one who was better than him, the Messenger of Allah ﷺ.Shaqiq is Ibn Salama, Abu Waail al-Asadi.
حدثنا هناد حدثنا أبو معاوية عن الأعمش عن شقيق
قال لنا رسول الله ﷺ إذا حضرتم المريض أو الميت فقولوا خيرا فإن الملائكة يؤمنون على ما تقولون قالت فلما مات أبو سلمة أتيت النبي ﷺ فقلت يا رسول الله إن أبا سلمة مات قال فقولي اللهم اغفر لي وله وأعقبني منه عقبى حسنة قالت فقلت فأعقبني الله منه من هو خير منه رسول الله ﷺ شقيق هو ابن سلمة أبو وائل الأسدي
Reference وأخرجه مسلم الجنائز، باب ما يقال عند المريض والميت، ح:٩١٩ من حديث أبي معاوية الضرير به.Also narrated by Muslim in Janaiz, chapter on what is said in the presence of the sick and the dead, hadith no. 919, through Abu Muawiya Dareer, with the same wording.