The Messenger of Allah (ﷺ) said during his illness from which he never recovered: Allah…

Sahih Muslim Book 5 Hadith 24

Sahih Muslim #529

The Book of Mosques and Places of Prayer 5:24

'A'isha reported:

The Messenger of Allah (ﷺ) said during his illness from which he never recovered: Allah cursed the Jews and the Christians that they took the graves of their prophets as mosques. She ('A'isha) reported: Had it not been so, his (Prophet's) grave would have been in an open place, but it could not be due to the fear that it may not be taken as a mosque.

Chapter: The prohibition of building masajid over graves and placing images therein; and the prohibition of taking graves as masajid

Grade: Sahih