Shaykh `Abd al-Qadir al-Jilani writes the following in the section on entering Madina at the end of the section on the Pilgrimage in his book al-Ghunya li talibi tariq al-Haqq `azza wa jall:
Entering Madina the Illuminated :If Allah blesses the pilgrim with prosperity and he is able to come to Madina, then what is desirable for him is that he come to the mosque of the Prophet and say upon entering it: allahumma salli `ala muhammadin wa `ala ali muhammad, waftah li abwab rahmatik, wa kaffi `anni abwab `adhabik, al-hamdu lillah rabb al-`alamin. O Allah, send blessings upon Muhammad and upon the family of Muhammad, and stem for me the gates of your mercy, and close for me the gates of your punishment, all praise belongs to Allah. Then let him come to the grave of the Prophet and stand in its proximity so that he will be between the grave and the Qibla, and let him stand so that the facade of the Qibla will be behind him and the grave in front of him exactly facing his face, and the minbar to his left... Let him then say: Peace upon you, O Prophet, and Allah's mercy and His blessings!O Allah, send blessings upon Muhammad and upon the family of Muhammad as you have sent blessings upon Ibrahim, praised and glorified are You! O Allah, bestow upon our master Muhammad the Means (al-wasila) and the Priority (al-fadila) and the high rank (al-daraja al-rafi`a), and raise him to the exalted station (al-maqam al-mahmud) which You have promised him! O Allah, send blessings upon the spirit of Muhammad among all spirits, and upon his body upon all bodies, just as he has conveyed Your Message and recited Your signs and fought according to Your command and striven in Your path and commanded that You be obeyed and forbade that You be disobeyed and opposed those who opposed You and befriended those who befriended You and served You until death came to him. O Allah, You said to Your Prophet in Your Book: "If they had only, when they were unjust to themselves, come unto thee and asked Allah's forgiveness, and the Messenger had asked forgiveness for them, they would have found Allah indeed Oft-returning, Most Merciful" (4:64), and I have come to Your House [sic; two other manuscripts have: "and I have come to You"] in repentence from my sins and seeking forgiveness, therefore I ask You that you make forgiveness guaranteed for me as you have made it guaranteed for those who came to him in his lifetime acknowledging their sins, so that their Prophet invoked You on their behalf and You forgave them.
O Allah! I am turning to You with Your Prophet, upon him Your peace, the Prophet of mercy. [TAWASSUL]
O Messenger of Allah! I am turning with you to my Lord so that He will forgive me my sins. [ISTHIGATHA]
O Allah, I am asking You for his sake (bi haqqihi) that You forgive me and grant me mercy. Allah, grant to Muhammad that he be the first of the intercessors, the most successful of those who ask, and the most honorable of the first and the last. O Allah, just as we believed in him without seeing him; and just as we confirmed him without meeting him: enter us where he entered and raise us in his group and bring us to his pond and quench us with his cup of a satisfying, pure, fresh, whole drink after which we shall never thirst , and keep us forever away from disappointment, betrayal, deviation, negation, and doubt, and make us not of those You are angered against, nor of the misguided, but place us among the people of his intercession. Then let him step to his left and say:
Peace be upon both of you, O Companions of Allah's Messenger, and Allah's mercy and His blessings. Peace be upon you, O Abu Bakr the Most-Truthful. Peace be upon you, O `Umar the Distinguisher. O Allah, reward them with abundant good on behalf of their Prophet and all Islam, and forgive us and our brothers who preceded us in the faith, and do not place in our hearts rancor towards the believers, O Allah! for You are most kind, merciful. Then let him pray two rak`at and sit. It is desirable that he pray between the grave and the pulpit in the Rawda; and, if he so desires, that he rub the pulpit to take its blessing (wa in ahabba an yatamassah bi al-minbar tabarrukan bih); and that he pray in the mosque of Quba'; and that he go visit the graves of the martyrs and make abundant invocations there. Then, if he wants to leave Madina, let him come to the Prophet's mosque, approach the grave, greet the Prophet, and do exactly as he did before, then bid him farewell and similarly greet his two Companions and bid them farewell. Then let him say: O Allah, don't make this the last of my visit to the grave of Your Prophet, and if you cause me to die, then make me die loving him and his Sunna. Amin, O most merciful of the merciful!Then he may leave in peace, by Allah's will.[ al-Ghunya li talibi tariq al-Haqq `azza wa jall ] http://www.sunnah.org/ibadaat/ziyara.htm