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.
Visiting graves is Sunnah. Islamic Sharee’ah urges Muslims to visit graves. In fact, it is a good remedy to the hard hearts since it reminds them of death and the Hereafter, and both of these matters limit the desires of people and put an end to their interest in worldly matters.
There are many etiquettes that should be followed at the time of visiting graves; some of them are as follows:
1- Greeting the buried Muslims and supplicating for them. Buraydah reported from the Prophet that he used to teach his companions to supplicate with this supplication whenever they visit the graves: “Peace be upon you all! O inhabitants of the graves, amongst the believers and the Muslims. Verily, we will, Allah willing, be united with you; we ask Allah for well-being for us and you.” [Muslim]
2- Abstaining from sitting on graves. Abu Hurayrah narrated that the Prophet said: “It is better for you to sit on a glowing coal that burns through your clothes to your skin than to sit on a grave.” [Muslim]
3- Taking off footwear while walking between graves. Basheer Ibn Al-Khassaasiyyah reported that once the Prophet noticed a man wearing shoes while walking in the cemetery. He said to him: “O you who are wearing the sibtiyah (shoes), take off your sibtiyah (shoes).” [Abu Dawood] Imam Ahmad said: “The chain of this Hadeeth is Hasan; so, I act according to it.”
Know that there is no fixed time for visiting graves. It is an innovation to visit graves only at particular times. A Muslim should follow the above-mentioned manners at the time of visiting graves and should abandon innovation.
Moreover, it is better for one whose father died to be faithful to him as much as possible. Being thankful to him means acknowledging his previous favors and being grateful for his kind acts. Here are some deeds one can practice in recognition of the favors of his father.
1- Supplicating for him. Abu Hurayrah narrated that the Prophet said: “When a man dies, his deeds come to an end, except for three: a continuous charity, knowledge by which people derive benefits, a pious child who supplicates for him.” [Muslim]
2- Being kind with his friends and beloved persons. Ibn ‘Umar narrated that the Prophet said: “The noblest deed is that a person should be benevolent towards his father's friends after his death.” [Muslim]
3- Paying the rights of Allah that were due on him, such as the Zakaah, fasting, etc., and settling the rights of the public that were due on him, such as debts, deposits etc. Ibn ‘Abbas reported that 'a man (in another narration a woman) came to the Prophet and said: “O Allah's Prophet! My mother died and she ought to have fasted one month. Shall I fast on her behalf? The Prophet replied in the affirmative and said, “Allah's debts have more right to be paid.”
4- One may also do the deeds that are mentioned in the following Hadeeth. Abu Usayd As-Saa'idi reported that while we were with the Prophet of Allah, a man from Banu Salamah came to him and said: ‘O Apostle of Allah! Is there any kindness left that I can do to my parents after their death? He replied: “Yes, you can invoke blessings on them, ask forgiveness for them, carry out their final instructions after their death, join ties of relationship which are dependent on them, and honor their friends.’ [Abu Daawood and Ibn Maajah]
5- Giving charity on behalf of dead parents as much as one can, especially the continuous charity; i.e., making an endowment.
The reward of the recitation of the Quran reaches the dead person. But reciting Surah Al-Faatihah on/near a grave is not confirmed.
What is proved from the Prophet is reciting the supplication As-Salaam Alaykum, as mentioned above.
There is another supplication reported from the Prophet and that could be also said at the time of visiting graves. The supplication is: (Peace be upon you all! O inhabitants of the graves; may Allah forgive us and you, you have preceded us, and we will follow you).
If one visits a particular grave, such as the grave of his father, relative, etc., one should greet them as one greets living people. Asking forgiveness and mercy for them is also permissible.
Allah knows best.