Sulayman bin Buraydah narrates from his father (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) used to teach them that when they entered the graveyard they should say: "'As-salamu alaykum ahla al-diyari min al-mu'minina wa al-muslimin, wa inna in sha' Allahu bikum lahiqun, nas'alu Allaha lana wa lakum al-afiyah' (Peace be upon you, O believing and Muslim dwellers of these abodes! And surely we too, if Allah wills, shall join you. We ask Allah for well-being for us and for you.)"
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الجنائز / 7212