Tamim inspired the hosts with 151 off 183 balls and shared a record 200-run partnership with Zunaed Siddique as Bangladesh reduced their 311-run deficit to 83.
Tamim, who struck 18 fours and three sixes in his second test century, just missed out on the record individual score by a Bangladeshi, Mohammad Ashraful’s 158 not out against India in 2004.
Zaheer, who made India’s first breakthrough with the wicket of Imrul Kayes, forced Zunaed to edge a catch to wicketkeeper Mahendra Singh Dhoni for 55.
He also snapped up the prized wicket of Tamim, caught by Dhoni just one over before the close. Ashraful and nightwatchman Shahadat Hossain will both resume on the fourth day on two.
“They played very well today. We know it’s a very good wicket to bat on at the moment. We thought it would take more turn but it has not done that much so it’s a good performance,” India coach Gary Kirsten told reporters.
“Maybe we were a little bit impatient and we did not bowl as well as we can. I am very happy with the two wickets at the end.”
Tamim said he was disappointed to get out before the close.
“The end did not happen the way I wanted,” he said. “If I could have stayed unbeaten it would be good for the team and there could be a chance to get a double century.”
India declared their first innings on 544 for eight, building a daunting lead in their bid to clinch the series 2-0.
Dhoni fell 11 runs short of what would have been his fourth test century, stumped off part-time leg-break bowler Raqibul Hasan.
India, resuming on 459 for five overnight, earlier lost the wickets of Zaheer for nought and Ishant Sharma for 13.
Yuvraj Singh was unable to bat because of a wrist injury while Rahul Dravid, who retired hurt on 111 on Monday, failed to resume his innings.
Scoreboard
Bangladesh first innings 233
India first innings (overnight 459-5)
G. Gambhir Rahim b Shafiul 68
V. Sehwag c Rahim b Shahadat 56
R. Dravid retired hurt 111
S. Tendulkar c Imrul b Shakib 143
M. Vijay c Mahmudullah b Shakib 30
M. Dhoni st Rahim b Raqibul 89
H. Singh c Rahim b Shafiul 13
Z. Khan c Shahadat b Shafiul 0
I. Sharma c Rahim b Ashraful 13
P. Ojha not out 1
Extras (b-3 lb 6 w-1 nb-10) 20
Total (eight wickets declared; 133 overs) 544
Did not bat: Y. Singh
Fall of wickets: 1-103 2-146 3-421 4-436 5-459 6-467 7-518 8-544
Bowling: Shafiul 23-1-86-3 (w-1), Shahadat 22-2-91-1 (nb-2) Rubel 28-1-115-0 (nb-8), Shakib 34-3-118-2, Ashraful 9-0-38-1, Mahmudullah 15-0-78-0, Zunaed 1-0-9-0, Raqibul 1-1-0-1.
Bangladesh second innings
T. Iqbal c Dhoni b Zaheer 151
I. Kayes c sub (Karthik) b Zaheer 5
S. Hossain not out 2
M. Ashraful not out 2
Extras (b-7 lb-4 w-2) 13
Total (three wickets; 60 overs) 228
To bat: R. Hassan, S. Hasan, M. Rahim, Mahmudullah, S. Islam, R. Hossain.
Fall of wicket: 1-19 2-219 3-222
Bowling: Zaheer 14-1-63-3 (w-1), Ishant 11-2-38-0, Harbhajan 17-3-59-0, Ojha 11-1-46-0, Sehwag 7-2-11-0 (w-1)