Authentic Supplication Number 132.

Allah the Exalted said:

“Those that say, when afflicted with calamity, ‘Inna lil-lahi wa ‘inna ‘ilayhi raji`oona. They are those upon whom [descend] blessings from their Lord and Mercy. And they are the ones who are guided.” (Al- Baqarah 2:156-157)

‘Ummu Salamata  said: I heard the Messenger of Allah  saying: “There is not a slave afflicted with a calamity who then says: ‘Inna lil-lahi wa ‘inna ‘ilayhi raji`oona, ‘allahumma’jurnee fee museebatee, wa ‘akhliflee khayran minha (154) except that Allah would grant him reward in his calamity, and would succeed it with good consequence for him.

She said: So when Abu Salamata [her husband] died; I said like the Messenger of Allah  had commanded me. So Allah caused him to be succeeded with one who was better than him for me: the Messenger of Allah.

Footnotes.
(154) We are for Allah, and we are, to Him, returning. O’ my ‘ilah grant me reward in my calamity, and cause it to succeeded with good consequence for me.

Reporters.
Reported by Muslim, and is #114 in The Authentic of Good Sayings.