The formula of sending blessings on the Messenger when visiting his grave
Among the common formulae of greeting the Prophet when visiting his grave are the following, "as-salatu was-salamu `alayka ya rasul Allah, i.e. Peace and blessings be upon you, O Messenger of Allah" and "Allahumma sallai `ala Muhammad wa `ala ali Muhammad, i.e. O Allah, invoke blessings upon Muhammad and his family," which of them is better?
Also, does the Prophet (peace be upon him) look at a person who greets him at his grave? Is it true that the Prophet (peace be upon him) waved a hand out of his grave to greet one of his honorable Sahabah (Companions) or the pious people in return for their greetings?
To the best of my knowledge, no certain formula of greeting the Prophet has been authentically reported from the Prophet (peace be upon him). Thus, both the formulae mentioned above are true. However, it is better to use the first formula i.e. the indicative mood, as done when visiting all other graves for it is also invocatory in meaning. This preference is supported by the practice of
Ibn `Umar (may Allah be pleased with them both) who used to say when visiting the Prophet: (Part No. 1; Page No. 475)
Peace be upon you, Messenger of Allah! Peace be upon you, Abu Bakr! Peace be upon you, my father!
Then he would leave.
It is not confirmed in the Qur'an or the authentic Sunnah (whatever is reported from the Prophet) that the Prophet (peace be upon him) may see those who visit his grave. The basic legal rule is the impossibility of sight until the evidence proves the opposite by means of the texts of the Qur'an or the Sunnah.
The basic legal rule also states that the dead; a prophet or not, does not move in the grave by hands or otherwise. As for the claim that the Prophet (peace be upon him) took his hand out for a while to return greetings, it is not correct. It is a baseless illusion.May Allah grant us success. May peace and blessings be upon our Prophet Muhammad, his family, and Companions.