Sunan Abi Dawud, Book 21, Hadith 147 (Abu Dawud 3236)

Narrated Buraidah:

The Messenger of Allah (ﷺ) as saying: I forbade you to visit graves, but you may now visit them, for in visiting them there is a reminder (of death).