Assalamualaikum ustaz. Are there specific manners one should be mindful of when visiting the grave of Rasullullah PBUH? Thank you.
Waalaikumussalam wrt. wbt.,
Alhamdulillah, praise and gratitude to Allah SWT for His countless blessings for us all. Praise and salutations to our beloved Prophet Muhammad PBUH, his family, companions, and all those who follow his footsteps until the Final day.
We begin with the statement of Allah SWT:
الَّذِي خَلَقَ الْمَوْتَ وَالْحَيَاةَ لِيَبْلُوَكُمْ أَيُّكُمْ أَحْسَنُ عَمَلًا ۚ وَهُوَ الْعَزِيزُ الْغَفُورُ
[He] who created death and life to test you [as to] which of you is best in deed – and He is the Exalted in Might, the Forgiving,” 
One of the signs of the greatness of Allah SWT is that He is the One who created life and death; life and death are among His creations. He grants life to those He wishes by giving life to something dead before and afterwards gave them death not from what the creations wanted. The reason is the wish to give life or death is owned only by Allah SWT. Furthermore, this verse clearly explains the wisdoms of the creation of life and death; which is as a test for His slaves, so that the good of a good person is clear and the evils of an evil person is clear. Allah the Almighty, His decisions and commandments will be implemented and He is the Forgiver for those who repent and improve themselves. 
Visiting graves is a commandment in Islam. It is a sunnah according to a sahih opinion. This is based on numerous evidences although at the beginning Rasullullah PBUH restricted visiting graves but later he permitted and instructed it. From Buraidah, Rasullullah PBUH said:
نَهَيْتُكُمْ عن زِيارَةِ القُبُورِ، فَزُورُوها فإِنَّها تُذَكِّرُكمُ الموتَ
“I used to forbid you to visit the graves, but now visit them, for they remind you of the Hereafter.” 
It is clear that the main purpose of visiting graves is to remember death. Furthermore, there is also another narration with the wording:
فإنَّها تذَكِّرُ الآخرةَ
“It (visiting the grave) will remind you of the Hereafter.” 
Likewise, it is sunnah to visit the grave of Rasullullah PBUH and the person who does so will be greatly rewarded. Especially, the encouragement and rewards of visiting graves are multiplied when the grave is the grave of Rasullullah PBUH. 
This is based on the hadith where Rasullullah PBUH said to Mu’az when he was sent to Yemen:
يَا مُعَاذُ، عَسَى أَنْ لاَ تَلْقَانِي بَعْدَ عَامِي هَذَا، وَلَعَلَّكَ أَنْ تَمُرَّ بِمَسْجِدِي هَذَا وَقَبْرِي
“O Muaz! Indeed, maybe you’ll not be able to meet me again after this year. Hopefully, you visit my mosque and grave.” 
Manners when visiting the grave of Rasullullah PBUH
Coming back to the question asked, surely there are manners to complete a visit to the grave as stated by scholars. We state here what is written in al-Fiqh al-Manhaji (2/173-174) regarding this matter. Among them are:
- It is sunnah to set the intention to visit the Prophet PBUH and his mosque when headed to Medina so that one will receive rewards for both of them. Likewise, it is also sunnah to increase one’s praise and salutations to the Prophet PBUH during the journey.
- It is sunnah to take a bath before entering Medina if there is facilitation. If there isn’t facilitation, take a bath before entering the mosque and wear clean clothing.
- When arriving at the entrance door of the mosque, the Prophet PBUH steps in with his right hand and recited:
أَعُوْذُ بِاللهِ العَظِيْمِ وَبِوَجْهِهِ الكَرِيْمِ وَبِسُلْطَانِهِ القَدِيْمِ مِنِ الشَّيْطَاِن الرَّجِيْمِ، بِسْمِ اللهِ، وَالْحَمْدُلله، اللَّهُمَّ صَلِّ عَلَى مُحَمَّدٍ، وَعَلَى آلِ مُحَمَّدٍ وَسَلَّمَ. اللَّهُمَّ اغْفِرْلِي ذُنُوْبِي وَافْتَحْ لِي أَبْوَابَ رَحْمَتِكَ
“I seek refuge in Almighty Allah, By His Noble Face, By His primordial power, From Satan the outcast. [In the Name of Allah, and blessings and peace be upon the Messenger of Allah. O Allah, open before me the doors of Your mercy.”
- After praying in Raudhah, go to the honoured grave of the Prophet PBUH. Stand there facing the wall of the grave with one’s back towards the qibla, approximately 4 hasta from the head.
As one is bowing and facing the walls of the tomb, empty one’s thoughts from worldly matters as though he is really meeting the Prophet PBUH with all his honour and glory and give salam politely to him:
السَّلاَمُ عَلَيْكَ يَا رَسُوْلَ اللهَ، السَّلاَمُ عَلَيْكَ يَا نَبِيَّ اللهِ، السَّلاَمُ عَلَيْكَ يَا خَيْرَةَ اللهِ، السَّلاَمُ عَلَيْكَ يَا خَيرَةَ رَبِّ العَالَمِيْنَ. جَزَاكَ اللهُ يَا رَسُوْلَ اللهَ عَنَّا أَفْضَلَ مَا جَزَى نَبِيًّا وَرَسُوْلاً عَنْ أُمَّتِهِ. أَشْهَدُ أَنْ لآ إِلَهَ إِلاَّ اللهُ، وَحْدَهُ لاَ شَرِيْكَ لَهُ، وَأَشْهَدُ أَنَّكَ عَبْدُهُ وَرَسُوْلِهِ مِنْ خَلْقِهِ، وَأَشْهَدُ أَنَّكَ قَدْ بَلَّغْتَ الرِّسَالَةَ، وَأَدَّيْتَ الأَمَانَةَ، وَنَصَحْتَ الأُمَّةَ، وَجَاهَدْتَ فِي اللهِ حَقَّ جِهَادِهِ
“Peace be upon you, o Rasullullah. Peace be upon you, o Prophet of Allah. Peace be upon you, o the person chosen by Allah. Peace be upon you, o someone who Allah chose over the entire universe. May Allah rewards you on our behalf o Rasullullah, with the best of rewards to the prophets and Messengers for their ummah. I bear witness that none should be worshipped other than Allah SWT and there is none like Him. And I bear witness that you are His slave and Messenger from among His creations. I bear witness that you’ve conveyed your teachings, fulfil your responsibility, advise the ummah and went for jihad for Allah with true jihad.”
Then, move to the right a little at the grave of Abu Bakr and give salam:
السَّلاَمُ عَلَيْكَ يَا أَبَا بَكْرِ الصِّدِّيْقِ
“Peace be upon you, o Abu Bakar al-Sidiq.”
Then, move a little to the right to the grave of Umar bin al-Khattab and give salam saying:
السَّلاَمُ عَلَيْك يَا عُمَرَ بِنْ الْخَطَّابِ
“Peace be upon you, o Umar al-Khattab.”
Then, return to the place at the beginning. As one is facing the qibla, supplicate for yourself and all the believers, any supplication or desires that he wishes. Indeed, it is the time when supplications are granted, Insya-Allah.
- It is impermissible to perform tawaf at the grave of the Prophet PBUH. Al-Nawawi stated: “It is makruh stand close to the walls of the tomb, rubbing and kissing it, as what was done by the ignorant. The mindful manner is to stay or be a short distance away from the tomb. Just like one is standing in front of the Prophet PBUH during his life.”
- It is best to pray in Rasullullah PBUH’s mosque when one is in Medina and visit the Baqi’ graveyard every day as well as the graves of martyrs in Uhud. Likewise, it is sunnah muakkad to visit the Quba’ Mosque as narrated in a sahih hadith of Bukhari and Muslim and others, the Prophet PBUH always visited them on Saturdays.
Thus, we concluded that among the main purposes that it is permissible to visit graves is to remind us of death and the hereafter. Furthermore, it is sunnah to visit the grave of Rasullullah PBUH and receive the rewards for those who do so. Especially, when the encouragement and rewards will be multiplied when the grave visited is the grave of Rasullullah PBUH. However, at the same time, we should be mindful of the manners when visiting it, hopefully, by maintaining these matters will complete the rewards of the visit we do. Subsequently, increase the love we have for the Prophet PBUH.
May Allah SWT grant us all a clear understanding in this religion. Amin.
 Surah al-Mulk: 2
 See Tafsir al-Madinah al-Munawwarah, pg. 1714.
 Narrated by Muslim (1977); Ahmad (13487); al-Hakim (1388)
 Narrated by al-Tirmizi (1054); Ahmad (23016)
 See al-Fiqh al-Manhaji, 2/172.
 Narrated by Ahmad (22702); Ibn Hibban (647); al-Bazzar (2647)