"BJP has suffered humiliating loss in the Lok Sabha seats held by the Chief Minister (Adityanath) and Deputy Chief Minister (Keshav Prasad Maurya) of Uttar Pradesh. Unity among the non-BJP parties has played a key role", he said in a tweet.
Speaking to reporters here, Mr Yadav also said that his party's relations with the Congress too continued to be good.
The Congress, poll analysts said, can strengthen its position only if it wins Karnataka and later states such as Rajasthan, Madhya Pradesh and Chhattisgarh, where it is in a direct contest with the BJP.
The results in Gorakhpur and Phulpur will have ramifications for national politics, with the opposition parties now expected to step up efforts to forge an electoral alliance against the BJP for 2019.
Dr. Sanjay Kumar of the Centre for the Study of Developing Societies said: "The SP-BSP alliance does pose a challenge, but any extrapolation with regard to its prospects in 2019 will depend on whether or not the alliance continues".
Arsenal midfielder Aaron Ramsey to undergo surgery
Aaron Ramsey is set to have a "small procedure" after the AC Milan fixture, meaning that he will miss worldwide duty with Wales . The player himself has suggested he is down the pecking order when it comes to Arsenal resolving contract situations.
In both seats, the Samajwadi Party fielded candidates, with the BSP offering support in a rare deal that includes the Samajwadi Party's support for the BSP in Rajya Sabha elections in UP later this month.
Mayawati, a former Uttar Pradesh chief minister, whose gamble of backing the Samajwadi Party (SP) for bypolls in Gorakhpur and Phulpur in the state paid rich dividends, said the idea behind the alliance was to teach the BJP a lesson.
He took a dig at Adityanath, saying the Chief Minister had been "mocking at the Constitution of India" through his words and actions. In fact, its high-margin of victory shows that it has managed to galvanise its core Muslim-Yadav vote base further after its fallout with the JD (U).
When the BJP establishes alliances with caste parties, it speaks of social justice. She defeated the Congress candidate Shambhu Patel, who had the RJD's support, by over 15,000 votes. For any political party, their star campaigners are widely used during election. "We can see BJP is sinking ..."
The results of Gorakhpur and Phulpur Lok Sabha bypolls, which saw arch-rivals SP and BSP joining hands, have rung an alarming bell for the BJP ahead of the parliamentary polls in 2019.
The Gorakhpur seat was vacated by Yogi Adityanath - which he held for five consecutive terms since 1998 - after he was elevated as the Uttar Pradesh Chief Minister.