Sayyidah Umm Salamah (may Allah be pleased with her) said: I heard the Messenger of Allah (peace and blessings be upon him) say: "When you are present with a dying person or a sick person, say what is good, for the angels say Amin to whatever you say." So when Abu Salamah (may Allah be pleased with him) died, I said: O Messenger of Allah, what should I say? He (peace and blessings be upon him) said: "Say: 'Allahumma ighfir lana wa lahu wa a'qibna minhu 'uqba salihah' (O Allah, forgive us and him, and grant us a good replacement after him)." She said: I said these words, and Allah Almighty gave me Muhammad (peace and blessings be upon him).
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الجنائز / 7124