The Messenger of Allah said: "I had prohibited you from visiting the graves. But Muhammad…

Jami` at-Tirmidhi Book 10 Hadith 90

Jami` at-Tirmidhi #1054

The Book on Jana''iz (Funerals) 10:90

Sulaiman bin Buraidah narrated from his father that:

The Messenger of Allah said: "I had prohibited you from visiting the graves. But Muhammad was permitted to visit the grave of his mother: so visit them, for they will remind you of the Hereafter."

Chapter: What Has Been Related About The Permission To Visit The Graves

Grade: Sahih (Darussalam)