Jami at-Tirmidhi 3511: Passing Away and Expressing Condolences
Hazrat Abu Salamah (ra) relates that the Messenger of Allah (saw) said: “When a calamity befalls any of you, he should recite Inna lillahi wa inna ilaihi raji'un (Surely to Allah we belong and to Him shall we return) and pray: ‘My Allah! I present my calamity before You; grant me a better reward for it, and in return for it bestow upon me good and blessing.’” So when the time of Abu Salamah's death drew near, he prayed: “O my Allah! Grant my family a good successor in my place.” When he died, Hazrat Umm Salamah (ra) recited Inna lillahi wa inna ilaihi raji'un and prayed: “I present my calamity before You; grant me a better reward for it.” (And so it happened that Hazrat Umm Salamah (ra) was married to the Holy Prophet (saw), and in this way Allah, the Exalted, granted her the best recompense.)
AI-translated by Islam-Today