Desirability of visiting the Graves for men, and that they should say

Imam Al-Nawawi’s Riyad-us-Saliheen
Chapter 66
Desirability of visiting the Graves for men, and that they should say

581. Buraidah (May Allah be pleased with him) reported: Messenger of Allah (sallallaahu ’alayhi wa sallam) said, “(In the past) I forbade you from visiting graves, but visit them now.”

In another narration Messenger of Allah (sallallaahu ’alayhi wa sallam) said, “Whoever wants to visit a graveyard, let him do so, because it reminds us of the Hereafter.”
[Muslim].

582. `Aishah (May Allah be pleased with her): reported Whenever it was her turn to spend with Messenger of Allah (sallallaahu ’alayhi wa sallam), he used to go to the Baqi` (graveyard in Al-Madinah) at the last part of night and say, “May you be safe, O abode of the believing people. What you have been promised has come to you. You are tarried till tomorrow and certainly we shall follow you if Allah wills. O Allah, forgive the inmates of the Baqi`-al-Gharqad.”
[Muslim].

583. Buraidah (May Allah be pleased with him) reported: The Prophet (sallallaahu ’alayhi wa sallam) used to teach them (i.e., the Companions) whenever they came out to visit the graveyard to say: “As-salamu `alaikum ahlad-diyyari minal-Mu’minina wal-Muslimina, wa inna in sha’ Allahu bikum lahiqun. As’alul-laha lana wa-lakumul- `afiyyah  (May you be safe, O inmates of the abodes of the believers and the Muslims, and if Allah pleases, we shall follow you, we pray to Allah for well-being for ourselves and for you).”
[Muslim].

584. Ibn `Abbas (May Allah be pleased with them) reported: Messenger of Allah (sallallaahu ’alayhi wa sallam) passed by the graves at Al-Madinah. He turned his face towards them and said, “May you be granted safety, O inmates of the graves. May Allah forgive us and you. You have preceded us, and we are to follow.”
[At-Tirmidhi].