Sahih Muslim Book 004, Hadith Number 2128.
Chapter : What is to be said while visiting the graveyard and the supplication to be offered for the dead lying in the graves.
Sulaiman b. Buraida narrated on the authority of his father that the Messenger of Allah (may peace be upon him) used to teach them when they went out to the graveyard. One of the narrators used to say this in the narration transmitted on the authority of Abu Bakr: "Peace be upon the inhabitants of the city (i.e. graveyard)." In the Hadith transmitted by Zuhair (the words are): "Peace be upon you, the inhabitants of the city, among the believers, and Muslims, and God willing we shall join you. I beg of Allah peace for us and for you."