Praise be to Allaah.
The Prophet (peace and blessings of Allaah be upon him) and his companions (may Allaah be pleased with them) explained how the funeral prayer is to be done. It is done as follows:
You say the first Takbeer (“Allaahu akbar”), then you seek refuge with Allaah from the accursed Shaytaan, then you say Bismillah ir-Rahmaan ir-Raheem and recite al-Faatihah followed by a short soorah or some aayahs. Then you say Takbeer and send blessings upon the Prophet (peace and blessings of Allaah be upon him) as one does at the end of the prayer. Then you say a third Takbeer and make du’aa’ for the deceased. The best is to say:
“Allaahumma ighfir lihaayina wa mayitina wa shaahidina wa ghaa’ibina wa sagheerina wa kabeerina wa dhakarina wa unthaana. Allaahumma man ahyaytahu minna fa ahyihi ‘ala’l-Islam wa man tawaffaytahu minna fa tawiffahu ‘ala’l-eemaan. Allaahumma ighfir lahu warhamhu wa ‘aafihi wa a’fu ‘anhu, wa akrim nuzulahu wa wassi’ madkhalahu waghsilhu bi’l-maa’ wa’l-thalj wa’l-barad, wa naqqihi min al-khataaya kama yunaqqa’ al-thawb al-abyad min al-danas. Allaahumma abdilhu daaran khayra min daarihi wa ahlan khayra min ahlihi. Allaahumma adkhilhu al-jannah wa a’idhhu min ‘adhaab il-qabri wa min ‘adhaab il-naar wa afsah lahu fi qabrihi wa nawwir lahu fihi. Allaahumma laa tahrimna ajrahu wa la tadillanaa ba’dahu
(O Allaah, forgive our living and our dead, those who are present among us and those who are absent, our young and our old, our males and our females. O Allaah, whoever You keep alive, keep him alive in Islam, and whoever You cause to die, cause him to die with faith. O Allaah, forgive him and have mercy on him, keep him safe and sound and forgive him, honour the place where he settles and make his entrance wide; wash him with water and snow and hail, and cleanse him of sin as a white garment is cleansed of dirt. O Allaah, give him a house better than his house and a family better than his family. O Allaah, admit him to Paradise and protect him from the torment of the grave and the torment of Hell-fire; make his grave spacious and fill it with light. O Allaah, do not deprive us of the reward and do not cause us to go astray after this).”
All of this was narrated from the Prophet (peace and blessings of Allaah be upon him). If you make du’aa’ with other words, this is OK, for example, you could say, “Allaahumma in kaana muhsinan fa zid fi ihsaanihi wa in kaana musee’an fa tajaawaz ‘an sayi’aatihi. Allaahumma ighfir lahu wa thabbit-hu bi’l-qawl il-thaabit (O Allaah, if he was a doer of good, then increase his good deeds, and if he was a wrongdoer, then overlook his bad deeds. O Allaah, forgive him and give him the strength to say the right thing).” Then you say a fourth Takbeer and pause for a little while, then you say one Tasleem to the right, saying “Assalaamu ‘alaykum wa rahmat-Allaah.”