The BJP received a massive setback as votes were counted in crucial by-elections today, with the Samajwadi Party winning both Gorakhpur and Phulpur, parliament seats vacated last year by Chief Minister Yogi Adityanath and his deputy Keshav Prasad Maurya as they joined the state government after the BJP's landslide win in the assembly elections.