162
إِنَّ لِلَّهِ مَا أَخَذَ، وَلَهُ مَا أَعْطَى، وَكُلُّ شَيْءٍ عِنْدَهُ بِأَجَلٍ مُسَمًّى... فَلْتَصْبِرْ وَلْتَحْتَسِبْ. أَعْظَمَ اللَّهُ أَجْرَكَ، وَأَحْسَنَ عَزَاءَكَ، وَغَفَرَ لِمَيِّتِكَ
Inna lillahi ma akhadha, walahu ma a'ta, wakullu shay'in 'indahu bi'ajalin musammana... faltasbir waltahtasib. a'zamallahu ajrak, wa ahsana 'aza'ak, waghafara limayyitik
Truly, to Allah belongs what He took, and to Him belongs what He gave, and everything with Him has an appointed term... so let her be patient and hope for the reward. — May Allah make your reward great, grant you fine consolation, and forgive your deceased.
The first part is the Prophet's ﷺ message to his daughter when her child was dying; the second is a formula of condolence reported by an-Nawawī in al-Adhkār.
Source Ṣaḥīḥ Muslim, The Book of Prayer - Funerals — site no. 2022 (similar wording) Ṣaḥīḥ · Ṣaḥīḥ al-Bukhārī 1284 (similar wording) Ṣaḥīḥ
Compiler cites al-Bukhārī 2/80; Muslim 2/636 || an-Nawawī, al-Adhkār p. 126