Sulaiman Ibn Buraidah narrates from his father, Allah be pleased with them that the Messenger of Allah, Allah send peace and blessings upon him used to teach them when they went out to the graveyard to say:
Peace be upon you O inhabitants of the abodes, believers and Muslims, we will join you if Allah wills, we ask Allah for our and your well being
حَدَّثَنَا مُحَمَّدُ بْنُ عَبَّادِ بْنِ آدَمَ، حَدَّثَنَا أَبُو أَحْمَدَ، حَدَّثَنَا سُفْيَانُ، عَنْ عَلْقَمَةَ بْنِ مَرْثَدٍ، عَنْ سُلَيْمَانَ بْنِ بُرَيْدَةَ، عَنْ أَبِيهِ، قَالَ كَانَ رَسُولُ اللَّهِ ـ صلى الله عليه وسلم ـ يُعَلِّمُهُمْ إِذَا خَرَجُوا إِلَى الْمَقَابِرِ كَانَ قَائِلُهُمْ يَقُولُ
السَّلاَمُ عَلَيْكُمْ أَهْلَ الدِّيَارِ مِنَ الْمُؤْمِنِينَ وَالْمُسْلِمِينَ وَإِنَّا إِنْ شَاءَ اللَّهُ بِكُمْ لاَحِقُونَ نَسْأَلُ اللَّهَ لَنَا وَلَكُمُ الْعَافِيَةَ
(رواه ابن ماجه، كتاب الجنائز، ١٥٤٧)