If someone usually prays Witr with eleven rak‘ahs and gets up for a third rak‘ah by mistake, can he regard it as Witr?
Question

                I pray Witr after ‘Isha’ with 11 rak‘ahs, two by two, after which I pray Witr with one rak‘ah. But yesterday, after having prayed two rak‘ahs with the tasleem, I prayed two more rak‘ahs, but instead of sitting for the tashahhud, I got up for a third rak‘ah by mistake, so I completed it and after that did the prostration of forgetfulness. But I did not know whether I should pray Witr with one rak‘ah after finishing that, so that it would be 11 rak‘ahs, or would the rak‘ah that I did by mistake be counted as one of them?
Praise be to Allah.If someone intends to pray two rak‘ahs of qiyaam al-layl [voluntary prayers at night], then gets up for a third rak‘ah by mistake, he may sit down when he remembers; he does not have to recite tashahhud again if he has already recited it, and he should do the prostration of forgetfulness and say the tasleem.
It is not permissible for him to continue praying so that he may regard it as Witr, because he did not intend to do that; rather he intended to pray two rak‘ahs.
It says in Sharh Muntaha al-Iraadaat (1/222): If he intends to pray two rak‘ahs of naafil (supererogatory) prayer, then he gets up for a third rak‘ah in the night prayer [qiyaam al-layl], then that is like getting up for a third rak‘ah in Fajr prayer. This was stated by Imam Ahmad, because of the hadith: “The night prayers are two [rak‘ahs] by two.” Moreover, it is a prayer in which it is prescribed to pray two rak‘ahs. End quote.
Before that, it says concerning one who gets up for a third [rak‘ah] in Fajr: If a worshipper gets up for an additional rak‘ah by mistake, such as a third [rak‘ah] in Fajr, or a fourth [rak‘ah] in Maghrib, or a fifth [rak‘ah] in a four-rak‘ah prayer, he should sit down without saying takbeer when he remembers that it is an additional rak‘ah, and this is obligatory, lest he change the form of the prayer, and he should not recite the tashahhud again if he had already recited it before standing up, because he has already done it in the right place.
If he had already recited the tashahhud but had not sent blessings upon the Prophet (blessings and peace of Allah be upon him), he should send blessings upon him, then do the prostration of forgetfulness and say the tasleem. If he had not recited the tashahhud before standing up, he should recite it, then do the prostration of forgetfulness, then say the tasleem.
If he does not remember that until he has finished the prayer, he should do the prostration of forgetfulness for it, because of the hadith of Ibn Mas‘ood, who said: The Messenger of Allah (blessings and peace of Allah be upon him) led us in prayer with five rak‘ahs, then when he had finished, the people began to murmur to one another. He said: What is the matter with you? They said: O Messenger of Allah, has something been added to the prayer? He said: No. They said: You prayed five [rak‘ahs]. So he turned to face the qiblah, then he prostrated twice, then he said the tasleem. Then he said: “I am only human, like you; I forget as you forget. So if one of you forgets, let him prostrate twice.”
According to another report, he said: “I am only human, like you; I remember as you remember, and I forget as you forget.” Then he did the two prostrations of forgetfulness. According to yet another report, he said: If a man does more or less (in the prayer), let him prostrate twice. Narrated by Muslim. End quote.
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) was asked: If the imam prays three rak‘ahs in Taraweeh, what should he do?
He replied: If he gets up for a third [rak‘ah] in Taraweeh by mistake, then he should sit down again; even if he has recited al-Faatihah, he should sit back down, and recite the tashahhud and the tasleem, then prostrate twice.
Imam Ahmad (may Allah have mercy on him) stated that if a man gets up for a third [rak‘ah] in the night prayer [qiyaam al-layl], it is as if he got up for a third rak‘ah in Fajr prayer, and it is known that if a man gets up for a third rak‘ah in Fajr prayer, he must sit back down, because Fajr cannot be offered with three [rak‘ahs], and similarly the night prayer cannot be more than two [rak‘ahs], because the Prophet (blessings and peace of Allah be upon him) said: “The night prayers are two by two.”
I have heard that some imams, if they get up to pray a third [rak‘ah] by mistake and are reminded of it, they carry on and pray four [rak‘ahs]. This in fact is ignorance on their part, and is contrary to the words of the Prophet (blessings and peace of Allah be upon him): “The night prayers are two by two.” What should be done is, if a person is reminded in the night prayer or in Taraweeh, even if that is after he has started to recite [Qur’an, in the third rak‘ah], he must sit back down and recite at-tahhiyyaat, and say the tasleem, then do the two prostrations of forgetfulness, and say the tasleem again.
End quote from Jalasaat Ramadaaniyyah.
Based on that:
You should have sat down as soon as you remembered, and done the prostration of forgetfulness and said the tasleem, then you should have prayed one more rak‘ah as Witr to finish your night prayers and make them odd numbered.
And Allah knows best.