Sahih al-Bukhari, Hadith 6514

Narrated Anas bin Malik: Allah's Messenger said, "When carried to his grave, a dead person is followed by three, two of which return (after his burial) and one remains with him: his relative, his property, and his deeds follow him; relatives and his property go back while his deeds remain with him."

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

sunnah.com