The decisive third Test starts in Rawalpindi on Tuesday.
At lunch, Pakistan were 35 runs away from winning the match.
India, resuming their second innings at 149 for five and needing to reach 202 to make Pakistan bat again, were dismissed for 241 following a valiant 62 not out from young wicketkeeper Parthiv Patel.
Set a target of 40 to level the three-match series on Thursday, Pakistan went to lunch at five for no loss.
The 19-year-old Patel added 55 for the sixth wicket with Virender Sehwag, and further frustrated the home bowlers with a fighting 75-run stand for the eighth with Ajit Agarkar who made 36.
India won the first Test in Multan by an innings and 52 runs, their first-ever win on Pakistan soil.
Pakistan's fiery pacer Shoaib Akhtar struck twice in his fourth over of the day when he dismissed Sehwag and Irfan Pathan in the space of five deliveries.
Sehwag, India's last recognised batsman, added four to his overnight score of 86 before he slashed at a wide delivery from Akhtar and was caught behind.
Sehwag, who hit an epic 309 in the first Test, hit 14 boundaries during his 145-minute resistance against the inspired Pakistan attack.
Pathan survived four balls before he was caught off Akhtar's rising delivery for zero to leave India at 160 for seven.
Agarkar hit Umer Gul to the cover boundary to help India avert the innings defeat.
Agarkar then launched an attack on leg-spinner Danish Kaneria, hitting him for two boundaries before Kaneria spun one sharply to have him caught in the slips.
Patel hit Mohammad Sami for two consecutive boundaries to equal his previous best of 62 against Australia at Sydney last year, but at the other end Kaneria claimed Anil Kumble, stumped by wicketkeeper Kamran Akmal.
Kaneria wrapped up the innings by trapping last man Laxmipathy Balaji to finish with 3 for 14.