Sahih Muslim , Book 55, Hadith 8 (In-Book)

Anas b. Malik reported Allah's Messenger as saying: Three things follow the bier of a dead man. Two of them come back and one is left with him: the members of his family, wealth and his good deeds. The members of his family and wealth come back and the deeds alone are left with him.

حَدَّثَنَا يَحْيَى بْنُ يَحْيَى التَّمِيمِيُّ، وَزُهَيْرُ بْنُ حَرْبٍ، كِلاَهُمَا عَنِ ابْنِ عُيَيْنَةَ، قَالَ يَحْيَى أَخْبَرَنَا سُفْيَانُ بْنُ عُيَيْنَةَ، عَنْ عَبْدِ اللَّهِ بْنِ أَبِي بَكْرٍ، قَالَ سَمِعْتُ أَنَسَ بْنَ مَالِكٍ، يَقُولُ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏ "‏ يَتْبَعُ الْمَيِّتَ ثَلاَثَةٌ فَيَرْجِعُ اثْنَانِ وَيَبْقَى وَاحِدٌ يَتْبَعُهُ أَهْلُهُ وَمَالُهُ وَعَمَلُهُ فَيَرْجِعُ أَهْلُهُ وَمَالُهُ وَيَبْقَى عَمَلُهُ ‏" ‏ ‏.‏

sunnah.com