Is it permissible to say: (O Messenger of Allah) when greeting the Prophet at his grave when we visit him in Hajj or at any other time? Was this proved by a Saheeh or Hasan Hadeeth? Is it permissible to face the direction of the grave of the Prophet and supplicate, raising one’s hands?
All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His Slave and Messenger.
There is no blame upon the Muslim if he says to the Prophet at his grave: “Peace be upon you, O Messenger of Allah.”
The companions, may Allah be pleased with them, used to do this as well as those who followed them. This is indicated by the Hadeeth in which the Prophet said: “If any one of you greets me, Allah returns my soul to me and I respond to the greeting.” [Abu Daawood]
The Prophet also said: “I hear whoever asks Allah to confer blessings upon me near my grave, and I am informed about whoever asks Allah to confer blessings upon me far away.” [Narrated by Abu Ash-Shaykh in Ath-Thawaab]
Al-Haafith said in Al-Fat-h: its chain of narrators is good. Maalik and Ahmad narrated on the authority of Naafi‘ that Ibn ‘Umar, may Allah be pleased with him, used to say, upon entering the Masjid: “Peace be upon you, O Messenger of Allah, peace be upon you, O Abu Bakr and peace be upon you, father.”
Concerning supplication, do not supplicate while facing the grave. After greeting the Prophet you may supplicate while facing the Qiblah, as narrated by Ibn ‘Umar, Anas and others. This is the opinion of the four Imams.
Allah Knows best.