Sunan Abi Dawud, Hadith 2518

Narrated Ubaydullah ibn Khalid as-Sulami: The Messenger of Allah made a brotherhood between two men, one of whom was killed (in Allah's path), and a week or thereabouts later the other died, and we prayed at his funeral). The Messenger of Allah asked: What did you say? We replied: We prayed for him and said: O Allah, forgive him, and join him to his companion. The Messenger of Allah said: What about his prayers since the time the other died, and his fasting since the time the other died--the narrator Shu'bah doubted the words, "his fasting--and his deeds since the time the other died. The distance between them is just like the distance between heaven and earth.

حَدَّثَنَا مُحَمَّدُ بْنُ كَثِيرٍ، أَخْبَرَنَا شُعْبَةُ، عَنْ عَمْرِو بْنِ مُرَّةَ، قَالَ سَمِعْتُ عَمْرَو بْنَ مَيْمُونٍ، عَنْ عَبْدِ اللَّهِ بْنِ رُبَيِّعَةَ، عَنْ عُبَيْدِ بْنِ خَالِدٍ السُّلَمِيِّ، قَالَ ‏:‏ آخَى رَسُولُ اللَّهِ صلى الله عليه وسلم بَيْنَ رَجُلَيْنِ فَقُتِلَ أَحَدُهُمَا وَمَاتَ الآخَرُ بَعْدَهُ بِجُمُعَةٍ أَوْ نَحْوِهَا، فَصَلَّيْنَا عَلَيْهِ، فَقَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏:‏ ‏"‏ مَا قُلْتُمْ ‏"‏ ‏.‏ فَقُلْنَا ‏:‏ دَعَوْنَا لَهُ، وَقُلْنَا ‏:‏ اللَّهُمَّ اغْفِرْ لَهُ وَأَلْحِقْهُ بِصَاحِبِهِ ‏.‏ فَقَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏:‏ ‏"‏ فَأَيْنَ صَلاَتُهُ بَعْدَ صَلاَتِهِ وَصَوْمُهُ بَعْدَ صَوْمِهِ ‏"‏ ‏.‏ شَكَّ شُعْبَةُ فِي صَوْمِهِ ‏:‏ ‏"‏ وَعَمَلُهُ بَعْدَ عَمَلِهِ إِنَّ بَيْنَهُمَا كَمَا بَيْنَ السَّمَاءِ وَالأَرْضِ ‏"‏ ‏.‏

sunnah.com