It was
narrated from Ibn Mas’ud that the Messenger of Allah (ﷺ)
said, “I
used to forbid you to visit the graves, but now visit them,
for they
will draw your attention away from this world and remind you
of the
Hereafter.”
Sunan Ibn Majah Book 6, Hadith 139