The Prophet ﷺ established a bond of brotherhood between two men. One of them was killed during the time of the Prophet ﷺ, and later the other died. The people prayed over him, and the Prophet ﷺ asked, "What did you say?"They replied, "We said, 'O Allah, forgive him. O Allah, have mercy on him. O Allah, join him with his companion.'"The Prophet ﷺ said, "But where are his prayers compared to the other's prayers? Where is his fasting, or his deeds, compared to the other's deeds? The distance between them is greater than the distance between the heavens and the earth."
حدثنا أبو النضر قال حدثنا شعبة عن عمرو بن مرة قال سمعت عمرو بن ميمون يحدث عن عبد الله بن ربيعة السلمي
آخى النبي ﷺ بين رجلين قتل أحدهما على عهد النبي ﷺ ثم مات الآخر فصلوا عليه فقال النبي ﷺ ما قلتم قال قلنا اللهم اغفر له اللهم ارحمه اللهم ألحقه بصاحبه فقال النبي ﷺ فأين صلاته بعد صلاته وأين صيامه أو عمله بعد عمله ما بينهما أبعد ما بين السماء والأرض
Its isnad is sahih. Amr bin Maymun Jazari is trustworthy and excellent, and his hadith is recorded by all the major compilers. Abdullah bin Rabia is a companion whose hadiths will appear at 4/336 of the printed edition.The hadith was narrated by Abu Dawud 3/16, no. 2523, in the chapter on jihad, on the light seen at a grave, and by Nasai 4/74, no. 1985, in the chapter on funerals, on supplication.