Bangladesh, who were forced to follow-on 492 runs behind after being shot out for 118 in their first innings, collapsed to 147-5 in their second knock by tea on the third day.
Zaheer, who claimed 5-34 in the first innings, rattled Bangladesh with the first two wickets on either side of the lunch break at the Sher-e-Bangla National Stadium.
The hosts were reduced to 10-3 soon after lunch before 22-year-old Mohammad Ashraful boosted the total with a breathtaking counter-attack that fetched him 67 off 41 balls.
Ashraful raced to 50 off just 26 deliveries, narrowly missing South African Jacques Kallis' world record of the fastest half-century in Test cricket in 24 balls against Zimbabwe in 2004.
Ashraful smashed 12 boundaries and two sixes with a flurry of drives, pulls and lofted shots that drew wild cheers from some 10,000 home fans who braved the hot and humid weather.
The Bangladesh vice-captain already holds the distinction of being Test cricket's youngest centurion after making 114 against Sri Lanka in 2001 at the age of 17.
The assault ended when Ashraful pulled the wily Anil Kumble uppishly to mid-wicket where Sachin Tendulkar took a low catch.
At tea, Saqibul Hasan was unbeaten on 13 and Khaled Mashud was on six.
Zaheer, who had taken three wickets the previous evening after India rattled up 610-3 declared, struck with the day's second delivery when Bangladesh started at 58-5.
Zaheer trapped Saqibul leg-before before the left-hander could add to his overnight score of 30.
Mashud and Mohammad Sharif took the score from 58-6 to 85 when Kumble trapped Sharif leg-before for 13.
Debutant seamer Ishant Sharma picked up his first Test wicket as Mashrafe Mortaza slashed a short ball into Kumble's safe hands at gully to reduce Bangladesh to 93-8.
Zaheer completed his fourth five-wicket haul when he bowled Mohammad Rafique, before Kumble terminated the innings by making Mashud (25) edge a catch to wicket-keeper Mahendra Dhoni.
Kumble finished with 3-32.
When Bangladesh began their second innings just before lunch, Zaheer dismissed opener Javed Omar for a first-ball duck for the second time in the match.
Omar, who was held in the slips in the first innings, was unlucky to be given out caught by the wicket-keeper down the leg side as television replays showed the bat did not deflect the ball.
Bangladesh captain Habibul Bashar fell soon after the break as he holed out a catch to his counterpart Rahul Dravid off Zaheer.
Rajin Saleh, who made 42, helped Ashraful add 81 for the fourth wicket, but both batsmen failed to survive till tea.
The first Test in Chittagong was drawn after rain washed out 15 of the scheduled 30 hours of play.