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."
Jami` at-Tirmidhi Book 10, Hadith 90