The Samajwadi Party retained the high-profile Mainpuri Lok Sabha seat, while the BJP wrested Rampur Sadar assembly seat in UP from it and Kurhani constituency in Bihar from the ruling Nitish Kumar-led alliance in results of the December 5 by-elections announced on Thursday.
The ruling BJP in UP, however, lost Khatauli to Samajwadi Party ally Rashtriya Lok Dal (RLD). The Congress retained its two assembly seats - Bhanupratappur in Chhattisgarh and Sardarshahar Assembly seat in Rajasthan's Churu district. The party is in power in the two states.
The BJD continued its dominance in Odisha, winning Padampur assembly seat in Bargarh district.
Out of the six assembly seats in five states where bypolls were held on Monday, the Congress and the BJP won two each while one each went to the BJD and RLD after counting of votes on Thursday.
Dimple Yadav, the wife of SP chief Akhilesh Yadav, defeated her nearest rival and BJP candidate Raghuraj Singh Shakya by 2,88,461 votes in Mainpuri, a pocket borough of SP patriarch Mulayam Singh Yadav's family.
The win would provide some solace to Akhilesh Yadav after the defeat in the Uttar Pradesh assembly elections early this year and the loss of Azamgarh and Rampur Lok Sabha seats to the BJP in June bypolls.
Samajwadi Party ally Rashtriya Lok Dal's Madan Bhaiya defeated his BJP rival Rajkumari Saini by a margin of over 22,000 votes in Khatauli. Saini is the wife of former BJP MLA Vikram Singh whose disqualification from the state assembly following his conviction in a 2013 Muzaffarnagar riots case necessitated the by-election.
Madan Bhaiya polled 97,071 votes, while Saini received 74,996, according to the Election Commission.
The BJP, however, for the first time won from SP leader Azam Khan's bastion Rampur Sadar which he represented before he was disqualified for his conviction in a hate speech case.
In Bihar, BJP candidate Kedar Prasad Gupta defeated Manoj Singh Kushwaha of Chief Minister Nitish Kumar’s JD(U) by 3,645 votes in Kurhani seat.
The JD(U) had snapped ties with the BJP four months ago.
In the cliffhanger of a contest, Gupta polled 76,653 votes while Kushwaha finished with 73,008 votes.
The by-election was necessitated by the disqualification of RJD MLA Anil Kumar Sahani. The RJD is a constituent of the ruling Mahagathbandhan (grand alliance).
"The victory is an affirmation of the people's faith in the leadership of Prime Minister Narendra Modi and a resounding slap in the face of Mahagathbandhan which came to power by fraud and continues to cheat the masses", said Samrat Chaudhary, senior BJP leader and former minister, as he joined the jubilations outside the counting centre in Muzaffarpur.
Congress' Anil Sharma defeated Ashok Kumar Pincha of the BJP by a margin of 26,850 votes in Rajasthan's Sardarshahar assembly, with Chief Minister Ashok Gehlot describing it as "people's seal of approval" on his government's "good governance and public welfare schemes".
This is the 10th time the Congress won the seat since Independence. The bypoll was necessitated following the demise of senior Congress leader and MLA Bhanwarlal Sharma, who is Anil Sharma's father.
Congress candidate Savitri Mandavi won from Bhanupratappur Assembly a margin of 21,171 votes against her nearest rival Brahmanand Netam of the BJP, a poll official here said.
Mandavi, the wife of Congress MLA Manoj Singh Mandavi whose death necessitated the by-election, polled 65,479 votes, while the BJP's Netam secured 44,308 votes, he said.
Former IPS officer Akbar Ram Korram, who contested as an independent, gave a spirited fight and polled 23,417 votes.
In Odisha’s Padampur, ruling BJD's Barsha Singh Bariha won by a margin of 42,679 votes, defeating the BJP’s Pradip Purohit.
Barsha is the daughter of late MLA Bijay Ranjan Singh Bariha whose death in October necessitated the by-poll.
Except for the headline, this story has not been edited by The Telegraph Online staff and has been published from a syndicated feed.