What is the ruling on praying supererogatory (naafil) prayers in Ramadan? What is the number of rak‘ahs that it is prescribed to pray in Taraweeh? I have seen some deviant groups, such as the Sufis and others, praying Taraweeh with thirty rak‘ahs. Is there any evidence for that?

Praise
be to Allah

Firstly: 

Offering supererogatory (naafil) prayers in Ramadan,
especially voluntary night prayers (qiyaam), comes under the heading of that
which is mustahabb (encouraged), because of the general encouragement to do
acts of worship in Ramadan, both prayers and other things, and because the
Prophet (blessings and peace of Allah be upon him) recommended praying
qiyaam in Ramadan especially. He said: “Whoever prays qiyaam in Ramadaan out
of faith and in the hope of reward, his previous sins will be forgiven.”
Narrated by al-Bukhaari (37) and Muslim (759). An-Nawawi (may Allah have
mercy on him) included it in a chapter entitled: Chapter: Encouragement to
pray qiyaam in Ramadan, which is Taraweeh. 

So it is encouraged for the Muslim in Ramadan to regularly
offer the Sunnah prayers both before and after the obligatory prayers, and
to regularly offer Taraweeh prayers in congregation with the Muslims. It is
also encouraged for him to offer supererogatory prayers in general, except
at the times when doing so is makrooh. 

For more information, please see the answer to question no.
21740.

Secondly: 

The Messenger of Allah (blessings and peace of Allah be upon
him) did not offer more than eleven rak‘ahs [in qiyaam al-layl], either
during Ramadan or at other times, although occasionally he prayed thirteen
rak‘ahs. Al-Bukhaari (3569) and Muslim (738) narrated from Abu Salamah ibn
‘Abd ar-Rahmaan that he asked ‘Aa’ishah (may Allah be pleased with her): How
did the Messenger of Allah (blessings and peace of Allah be upon him) pray
during Ramadan? She said: The Messenger of Allah (blessings and peace of
Allah be upon him) did not pray more, in Ramadan or at any other time, than
eleven rak‘ahs. He would pray four rak‘ahs, and do not ask how beautiful and
long they were. Then he would pray four, and do not ask how beautiful and
long they were. Then he would pray three. ‘Aa’ishah said: I said: O
Messenger of Allah, do you sleep before you pray Witr? He said: “O
‘Aa’ishah, my eyes sleep but my heart does not sleep.” 

Al-Bukhaari narrated that ‘Aa’ishah (may Allah be pleased
with her) said: The Messenger of Allah (blessings and peace of Allah be upon
him) would pray thirteen rak‘ahs at night, then he when he heard the call
for Fajr prayer, he would pray two brief rak‘ahs. 

An-Nawawi (may Allah have mercy on him) said: 

And it is narrated from ‘Aa’ishah (may Allah be pleased with
her) in al-Bukhaari that he prayed seven or nine rak‘ahs. After that, al-Bukhaari
and Muslim narrated the hadith of Ibn ‘Abbaas that he (blessings and peace
of Allah be upon him) would pray thirteen rak‘ahs at night, and two rak‘ahs
after dawn, the Sunnah prayer of Fajr. According to the hadith of Zayd ibn
Khaalid, he (blessings and peace of Allah be upon him) would pray two brief
rak‘ahs and two long ones… and he narrated the hadith, at the end of which
he said: And that was thirteen rak‘ahs. 

Al-Qaadi said: The scholars said: In these hadiths, Ibn
‘Abbaas, Zayd and ‘Aa’ishah each spoke of what they saw. End quote. 

Thirdly: 

The Prophet (blessings and peace of Allah be upon him) did
not specify any maximum number (of rak‘ahs) for Taraweeh prayer, and the
matter is broad in scope, in sha Allah. So there is nothing wrong with
someone praying more than eleven rak‘ahs, because of the general meaning of
the words of the Prophet (blessings and peace of Allah be upon him): “The
night prayers are two by two, then if one of you fears that dawn may come,
he should pray one rak‘ah, which will make what he has prayed odd-numbered.”
Narrated by al-Bukhaari (472) and Muslim (749). 

This is also the view of the fuqaha’ of madhhabs in various
regions. According to the Hanafi madhhab it is twenty rak‘ahs, as is also
the view of Imam Ahmad. According to Imam Maalik, it is thirty-six rak‘ahs,
and there is nothing wrong with a person doing any of these options, or
others. 

Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him)
said, after mentioning the difference of opinion among the scholars
concerning that: 

The correct view is that all of that is good, as was stated
by Imam Ahmad (may Allah be pleased with him), and there is no particular
number with regard to qiyaam al-layl in Ramadan. The Prophet (blessings and
peace of Allah be upon him) did not specify any number for that. As that is
the case, one may offer more or fewer rak‘ahs, according to how long or
short one wants to make the standing. The Prophet (blessings and peace of
Allah be upon him) used to make his standing lengthy, as it is proven from
him in as-Saheeh, in the hadith of Hudhayfah, that he used to recite
in one rak‘ah al-Baqarah, an-Nisa’ and Aal ‘Imraan. Making the standing
lengthy suffices instead of praying a greater number of rak‘ahs. When Ubayy
ibn Ka‘b led them in praying qiyaam, when they were a single congregation,
he would not make the standing lengthy for them, so he prayed a greater
number of rak‘ahs, instead of making the standing lengthy, and they made the
number of rak‘ahs double that of the Prophet (blessings and peace of Allah
be upon him), for he used to pray eleven or thirteen rak‘ahs of qiyaam al-layl.
Then after that the people in Madinah grew too weak to make the standing
lengthy, so they increased the number of rak‘ahs until it reached
thirty-nine. 

End quote from Majmoo‘ al-Fataawa (23/113; see also
23/120). 

The scholars of the Standing Committee for Issuing Fatwas
said: 

No specific number has been proven with regard to the number
of rak‘ahs in Taraweeh prayer, and the scholars differed concerning that.
Some of them think that it is twenty-three, some think it is thirty-six,
some think that it is more and some think that it is less. At the time of
‘Umar the Sahaabah prayed it with twenty-three rak‘ahs in the mosque of the
Messenger of Allah (blessings and peace of Allah be upon him), but the
Prophet never prayed more than eleven or thirteen rak‘ahs, whether in
Ramadan or otherwise, and he did not set any specific number for the people
to pray in Taraweeh and qiyaam al-layl. Rather he used to urge the people to
pray qiyaam al-layl and to pray qiyaam in Ramadan in particular. He would
say: “Whoever prays qiyaam in Ramadaan out of faith and in the hope of
reward, his previous sins will be forgiven”, and he did not specify the
number of rak‘ahs, which varies according to the nature of the standing.
Whoever makes his prayer lengthy may reduce the number of rak‘ahs, as the
Prophet (blessings and peace of Allah be upon him) did, and whoever makes
the prayer more brief, out of kindness towards the people, may make the
number of rak‘ahs greater, as the Sahaabah did at the time of ‘Umar. There
is nothing wrong with increasing the number of rak‘ahs in the last ten
nights of Ramadan, making it greater than in the first twenty nights, and
dividing them into two sections, one to be offered at the beginning of the
night and made brief, like Taraweeh in the first twenty nights, and another
section to be offered at the end of the night and made lengthy, to be
regarded as tahajjud. The Prophet (blessings and peace of Allah be upon him)
used to pray tahajjud in the last ten nights as he never did at any other
time. 

End quote from Fataawa al-Lajnah ad-Daa’imah, vol. 2,
6/82 

Conclusion: 

There is no specific number of rak‘ahs for Taraweeh prayer,
such that it is not allowed to do more or less than that. Whoever prays
Taraweeh with thirty rak‘ahs, or more or less than that, there is no blame
on him and he is not innovating by doing that. 

Shaykh Ibn Baaz (may Allah have mercy on him) said: 

There is no specific number for Taraweeh prayer. Whoever
prays twenty, there is nothing wrong with that; whoever prays thirty, there
is nothing wrong with that; whoever prays forty, there is nothing wrong with
that; whoever prays eleven, there is nothing wrong with that; whoever prays
thirteen, there is nothing wrong with that; and whoever prays more or less
than that, there is nothing wrong with that. The matter is broad in scope. 

End quote from Fataawa Noor ‘ala ad-Darb (9/437) 

For more information, please see the answer to question no.
9036

And Allah knows best.