On Permission for Men to visit Graves
Riyad as-Salihin (Gardens of the Righteous)
Riyad as-Salihin 584
Buraidah relates that the Holy Prophet said: I had forbidden you visiting graves; but now you might visit them (Muslim). One version is: He who wishes might visit graves for they remind us of the hereafter.
وفي رواية "فمن أراد أن يزور القبور فليزر؛ فإنها تذكرنا الآخرة "
Riyad as-Salihin 585
Ayesha relates that when it was the turn of the Holy Prophet to stay with me, he would go forth during the latter part of the night to Baqi‘ah (the cemetery) and his greeting was: Peace be on you dwellers of this home of the faithful. May you be given on the Day of Judgment according to the term appointed that which you have been promised. We shall, if Allah so wills, join you. Forgive, O Allah, the dwellers of Baqi‘ah (Muslim).
Riyad as-Salihin 586
Buraidah relates that the Holy Prophet taught that any of them visiting a cemetery should say: Peace be on you dwellers of this home of believers and Muslims, and we, if Allah so wills, shall join you. I supplicate for peace for you and for ourselves (Muslim).
Riyad as-Salihin 587
Ibn Abbas relates that the Holy Prophet passed by some graves in Medina. He faced towards them and said: Peace be on you dwellers of the graves. May Allah forgive you and us. You are our heralds and we are following you (Tirmidhi).