Riyad as-Salihin, Book 7, Hadith 921 (In-Book)

Umm Salamah (May Allah be pleased with her) reported: I heard the Messenger of Allah saying, "When a person suffers from a calamity and utters: 'Inna lillahi wa inna ilaihi raji'un. Allahumma ujurni fi musibati, wakhluf li khairan minha (We belong to Allah and to Him we shall return. O Allah! Compensate me in my affliction, recompense my loss and give me something better in exchange for it), then Allah surely compensates him with reward and better substitute." Umm Salamah (May Allah be pleased with her) said: When Abu Salamah (May Allah be pleased with him) died, I repeated the same supplication as the Messenger of Allah had commanded me (to do). So Allah bestowed upon me a better substitute than him (I was married to Muhammad, the Messenger of Allah).[Muslim].

وعنها قالت‏:‏ سمعت رسول الله صلى الله عليه وسلم يقول‏:‏‏"‏ما من عبد تصيبه مصيبه، فيقول إن لله وإنا إليه راجعون‏:‏ اللهم آجرني في مصيبتي، واخلف لي خيرا منها، إلا آجره الله تعالي في مصيبته واخلف له خيراً منها‏.‏ قالت‏:‏ فلما توفي أبو سلمة، قلت كما أمرني رسول الله صلى الله عليه وسلم ، فاخلف الله خيراص منه رسول الله صلى الله عليه وسلم “ ‏(‏‏(‏رواه مسلم‏)‏‏)‏‏.‏

sunnah.com