Answered by Ustadh Sufyan Qufi
Whilst traveling I was praying Dhuhr with the intention of praying 2 rakats.
However, after sitting down for the second rakah I forgetfully got up for the 3rd rakah and after realizing my mistake I decided to pray it as the full 4 rakats.
Is my prayer valid and was that the correct approach?
In the name of Allah, Most Compassionate, Most Merciful,
I pray this finds you in the best of states.
Praying While Traveling
Yes, your dhuhr prayer is valid because you have performed the obligatory sitting after the first two cycles. [Shurunbulali, Nur al-Idah]
Your dhuhr prayer would have been invalid only if you had forgotten to perform the first sitting. [Shurunbulali, Nur al-Idah]
Nonetheless what you have done is disliked because you have prayed four cycles instead of two. It would be better for you to repeat this prayer with two cycles only, even after the end of your trip. [Shurunbulali, Nur al-Idah]
It is obligatory to not go beyond two cycles for a four cycles prayer while traveling because of many sound (sahih) narrations. For example, Aisha, may Allah be pleased with her, said: “The prayer has been made first obligatory in the form of two cycles. The prayer of the traveler has remained in this way. The prayer of the resident has been increased [to four cycles]” [Bukhari, through the Binaya of Al-‘Ayni]
Adding an Extra Cycle
When you got up for a third cycle after the first sitting (which is in fact the last sitting for a dhuhr prayer while traveling) it would have been better for you to go back to the sitting position and give the ending salams of the prayer as long as you have not performed a prostration for the third cycle.
Nonetheless, after performing the prostration for the third cycle it is recommended to add a fourth cycle before ending the prayer. These two extra cycles will count as a voluntary prayer. [Maydani, Lubab]
Since you have added these extra cycles out of forgetfulness it was a duty for you to perform the prostrations of forgetfulness. [Shurunbulali, Maraqi al-Falah]
And Allah knows best.
[Ustadh] Sufyan Qufi
Checked and Approved by Shaykh Faraz Rabbani