Recommendation for men to visit the graves and what the one who visits them says

Riyad as-Salihin (The Meadows of the Righteous)

by Imam Nawawi

66. Chapter: On the recommendation for men to visit the graves and what the one who visits them says

581. Burayda reported that the Messenger of Allah, may Allah bless him and grant him peace, said, "I used to forbid you to visit graves, but now visit them." [Muslim]

582. 'A'isha said that whenever it was her night with the Messenger of Allah, may Allah bless him and grant him peace, he would go out at the end of the night to al-Baqi' and would say, "Peace be upon you, abode of a believing people. What you were promised will come to you tomorrow as decreed. Allah willing, we will join you. O Allah, forgive the people of Baqi' al-Gharqad." [Muslim]

[Baqi' al-Gharqad is the name of the cemetery of Madina. It was called Gharqad because of a type of thorny shrub (gharqad) which grew there.]

583. Burayda said, "The Prophet, may Allah bless him and grant him peace, used to instruct them that when they went out to the graves, they should say, 'Peace be upon you, people of the households of the believers and the Muslims. Allah willing, we will join you. I ask Allah for well-being for us and for you.'" [Muslim]

584. Ibn 'Abbas said, "The Messenger of Allah, may Allah bless him and grant him peace, passed by some graves at Madina and turned his face towards them and said, 'Peace be upon you, O people of the graves! May Allah forgive us and you. You preceded us and we are following afterwards.'" [at-Tirmidhi]