Bulugh al-Maram, Book 3, Hadith 63 (In-Book)

Sulaiman bin Buraidah narrated on the authority of his father (RAA) that the Prophet taught us that when we visit graves we should say, “Peace be upon you, O believing men and women, O dwellers of this place. Certainly, Allah willing, we will join you. We supplicate to Allah to grant us and you well being.” Related by Muslim.

وَعَنْ سُلَيْمَانَ بْنِ بُرَيْدَةَ عَنْ أَبِيهِ قَالَ: كَانَ رَسُولُ اَللَّهِ ‏- صلى الله عليه وسلم ‏-يُعَلِّمُهُمْ إِذَا خَرَجُوا إِلَى اَلمَقَابِرِ: { اَلسَّلَامُ عَلَى أَهْلِ اَلدِّيَارِ مِنَ اَلْمُؤْمِنِينَ وَالْمُسْلِمِينَ, وَإِنَّا إِنْ شَاءَ اَللَّهُ بِكُمْ لَلَاحِقُونَ, أَسْأَلُ اَللَّهَ لَنَا وَلَكُمُ الْعَافِيَةَ } رَوَاهُ مُسْلِم ٌ 1‏.‏ ‏1 ‏- صحيح.‏ رواه مسلم ( 975 )‏.‏

sunnah.com

also referenced under: Book 3, Hadith 619 (English)