Assalamualaikum ustaz. What should one do if the imam performed five takbir for the funeral prayer?
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 Last Day.
The number of takbir for funeral prayer is four. This is based on the actions of the Prophet PBUH narrated by Abu Hurairah:
نَعَى لِلنَّاسِ النَّجَاشِىَ فِى الْيَوْمِ الَّذِى مَاتَ فِيهِ فَخَرَجَ بِهِمْ إِلَى الْمُصَلَّى وَكَبَّرَ أَرْبَعَ تَكْبِيرَاتٍ
“The Prophet gave the people news of the death of the Negus on the day on which he died, took them out to the place of prayer, drew them up in rows and said “God is most great” four times.” 
In explaining this hadith, Imam al-Nawawi stated: “In this hadith, there is evidence of the number of takbir for funeral prayer and it is four. This is our madhhab and the madhhab of jumhur.” 
This is evidence that takbir in funeral prayer is four times. This is the opinion of the jumhur fuqaha’. Imam al-Nawawi emphasized this matter when he is commenting on the requisites of the funeral prayer in his book Minhaj al-Talibin.
Al-Hafiz Ibn Hajar cited the words of Saidina Umar RA which was recorded by Imam al-Baihaqi from Said bin al-Musayyab. Saidina Umar RA said: “The number of takbir performed before were four, five and six times. Hence, we decided to perform only 4.” 
In the above issue, if an imam pronounced the takbir 5 times in a funeral prayer, the prayer is still valid and it doesn’t affect the performed prayer. This matter is explained by Imam al-Nawawi who stated: “If a person performs takbir 5 times it doesn’t invalidate the prayer according to the qaul al-asah. And if the Imam performs the takbir 5 times one shouldn’t follow him according to qaul al-asah. He should just give the salam or wait to give salam together with the imam.” 
Ibnu Qasim al-Ghazzi said: “If an imam does this (takbir 5 times), then (the action) shouldn’t be followed. Whether the makmum gives salam (mufaraqah) or wait to give salam together with the imam. This is best.” 
Imam al-Baijuri explained: “The musonnif (Ibnu Qasim) said an imam who perform takbir five times isn’t followed, which means it isn’t sunnah to follow the additional takbir performed by the imam. If he still follows, then it doesn’t invalidate his prayer as issued in the fatwa of Imam al-Ramli. He said: He can give salam after setting the intention to mufaraqah or wait for a while so that he can give salam together with the imam. This is best.” 
Imam al-Nawawi also stated in his book al-Majmu’ that if he performed more than four takbir, it isn’t necessary to perform sahwi prostration. This is different from other prayers where it is obligatory to follow every action of the imam. 
We once prayed in al-Nabawi Mosque after the Asar prayer, the funeral prayer is performed. At the time, the imam is our teacher Syeikh Muhammad Ali al-Thani. He performed five takbir for the funeral prayer. When he was asked about it, he said that it is permissible and that the prayer is not invalid. Such is how I remembered it.
According to the above statement, if the imam performed 5 takbir when performing the funeral prayer, then it doesn’t invalidate the prayer. And it is the choice of the makmum whether to follow or not. If he decides to follow the imam, then supplicate for the deceased even when he has already done so in the previous takbir. Consequently, if he chooses not to follow the imam, he has a choice of mufaraqah and giving the salam or waiting for a while to give salam together with the imam.
Let us supplicate with all those who had died from amongst us:
اللَّهُمَّ اغْفِرْ لِحَيِّنَا وَمَيِّتِنَا وَصَغِيرِنَا وَكَبِيرِنَا وَذَكَرِنَا وَأُنْثَانَا وَشَاهِدِنَا وَغَائِبِنَا اللَّهُمَّ مَنْ أَحْيَيْتَهُ مِنَّا فَأَحْيِهِ عَلَى الْإِيمَانِ وَمَنْ تَوَفَّيْتَهُ مِنَّا فَتَوَفَّهُ عَلَى الْإِسْلَامِ اللَّهُمَّ لَا تَحْرِمْنَا أَجْرَهُ وَلَا تُضِلَّنَا بَعْدَهُ
“O Allah forgive our living and our dead, those who are with us and those who are absent, our young and our old, our menfolk and our womenfolk. O Allah, whomever you give life from among us give him life in Islam, and whomever you take away from us take him away in Faith. O Allah, do not forbid us their reward and do not send us astray after them.”