Hadithcore
Sahih Muslim, 2959 a
sahih

Abu Huraira reported Allah's Messenger (ﷺ) as saying:

A servant says, My wealth. my wealth, but out of his wealth three things are only his: whatever he eats and makes use of or by means of which he dresses himself and it wears out or he gives as charity, and this is what he stored for himself (as a reward for the Hereafter), and what is beyond this (it is of no use to you) because you are to depart and leave it for other people.

حَدَّثَنِي سُوَيْدُ بْنُ سَعِيدٍ، حَدَّثَنَا حَفْصُ بْنُ مَيْسَرَةَ، عَنِ الْعَلاَءِ، عَنْ أَبِيهِ، عَنْ أَبِي، هُرَيْرَةَ أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَالَ ‏

‏ يَقُولُ الْعَبْدُ مَالِي مَالِي إِنَّمَا لَهُ مِنْ مَالِهِ ثَلاَثٌ مَا أَكَلَ فَأَفْنَى أَوْ لَبِسَ فَأَبْلَى أَوْ أَعْطَى فَاقْتَنَى وَمَا سِوَى ذَلِكَ فَهُوَ ذَاهِبٌ وَتَارِكُهُ لِلنَّاسِ ‏

‏ ‏.‏

References2 variants
In-Book Reference
Book 55, Hadith 6
USC-MSA web (English) reference
Book 42, Hadith 7063 (deprecated numbering scheme)