Burayda reported,

Whenever the Messenger of Allah ﷺ passed by the graves, he would say, "Peace be upon you, dwellers of these abodes from among the believers and the Muslims. We, Allah willing, will join you. You have gone ahead of us, and we will follow. I ask Allah for well-being for us and for you."

Nasai 2042

Sahih

أخبرنا عبيد الله بن سعيد قال حدثنا حرمي بن عمارة قال حدثنا شعبة عن علقمة بن مرثد

عن سليمان بن بريدة عن أبيه

أن رسول الله ﷺ كان إذا أتى على المقابر فقال السلام عليكم أهل الديار من المؤمنين والمسلمين وإنا إن شاء الله بكم لاحقون أنتم لنا فرط ونحن لكم تبع أسأل الله العافية لنا ولكم

النسائي 2042صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Nasai Sughra
Book
Funerals
Chapter
Commanding to seek forgiveness for the believers
Numbering
Darussalam 2042
Nasai 2042