Dua 4
When offering condolences, say these words:
اِنَّ لِلّٰهِ مَآ اَخَذَ وَلَهٗ مَا اَعْطٰى وَكُلُّ شَيْءٍ عِنْدَهٗ بِاَجَلٍ مُّسَمًّى
Indeed, to Allah belongs what He has taken, and to Him belongs what He has given, and everything with Him has an appointed term.
After saying this, the bereaved should be urged to be patient and to hope for reward.
Sahih al-Bukhari, no. (7377), Sahih Muslim, no. (923), the wording is theirs, Sunan Abi Dawud, no. (3125), Sunan an-Nasa'i, no. (1868), Sunan Ibn Majah, no. (1588).
Some say there is some difference between the wording of al-Bukhari and Muslim, but that is entirely wrong; the truth is that the wording of both is exactly the same.