The saffron party bagged 44 seats, falling short of a two-thirds majority by two seats in the 68-member house. The BJP, which had won 26 seats in 2012, recorded a 10 per cent jump in vote share that touched 48.7 per cent.
The Congress bagged 210 seats. The ruling party had 36 seats earlier, and its vote share declined by 1 percentage point to 41.8 per cent. The CPI-M and an independent bagged one each. An independent was also leading in one seat.
Amid the victories, there was some disappointment for the BJP, Prem Kumar Dhumal, the party's chief ministerial candidate in the hill state, lost to Congress' Rajinder Rana in Sujanpur, after he changed his traditional constituency of Hamirpur. He was made the CM face only nine days before the polling.
In a tweet, Gandhi said his party "accepts the verdict of the people and congratulates the new governments in both states."
He thanked his party members for fighting "anger with dignity."
"We have set a record in the history of the BJP by winning consecutive assembly polls... Anti-incumbency is not working there. The prime minister's popularity is intact. Amit Shah's strategy has worked," BJP vice president Shyam Jaju said.
As the victories became clear, party workers gathered in the streets and headquarters, distributing sweets and bursting firecrackers.