It is narrated from Sayyiduna Mujammi' bin Jariyah al-Ansari (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) went out for the funeral of a man from Banu Amr bin Awf until he reached the graveyard, and he (peace and blessings be upon him) said three times: "As-salamu 'ala ahl al-qubur" (Peace be upon you, O people of the graves). Then he said: "Whoever among you was of the believers and the Muslims: you have gone ahead of us, and we will follow after you. May Allah grant well-being to us and to you."
Hadith Referenceالمعجم الكبير للطبراني / باب الميم / 17132