Bangladesh were wobbling at 51-5 before posting 233 in their first innings, thanks to lower-order batsman Mahmudullah who kept the Indian attack at bay with a gutsy 156-ball knock.
The visitors were indebted to pacemen Ishant Sharma (4-66) and Zaheer Khan (3-62) for restricting Bangladesh to a modest total. Left-arm spinner Pragyan Ojha was the other main wicket-taker with 2-49.
Bangladesh were 106-6 when Mahmudullah walked in to bat, but India had to struggle for the remaining wickets as he put on 58 useful runs for the ninth wicket with Shafiul Islam, who contributed only nine.
Harbhajan finished the innings when he bowled Rubel for his lone victim, leaving Mahmudullah just four short of his maiden Test hundred.
India's bowlers were superbly supported by wicket-keeper Mahendra Singh Dhoni, who took three catches and two stumpings after missing the previous Test due to an injury.
Ashraful and Shakib both fell to rash strokes. Ashraful stepped out to attempt a big shot off Ojha, missed the line and was stumped, while Shakib was caught behind chasing an away-going delivery from Zaheer.
Rahim, who added 55 for the sixth wicket with his captain, was trapped leg-before by Sharma after hitting six fours in his 61-ball knock.
India gained an early advantage when they left the hosts reeling at 84-5 in the morning session, with Zaheer and Sharma taking two wickets apiece and Ojha one.
Bangladesh's batting problems began immediately after winning the toss when Sharma had Kayes caught by Dhoni with his first delivery of the match.
Zaheer bowled opener Iqbal with a delivery that came in sharply and then had Siddique caught behind to reduce the hosts to 13-3.
Sharma's second victim was Raqibul Hasan, caught by Rahul Dravid at second slip after making only four.
India lead 1-0 in the short series following their 113-run victory in the opening Test in Chittagong on Thursday.
|Bangladesh 1st innings|
|Tamim Iqbal||b Zaheer||0|
|Imrul Kayes||c Dhoni b Sharma||0|
|Junaid Siddique||c Dhoni b Zaheer||7|
|Mohammad Ashraful||st Dhoni b Ojha||39|
|Raqibul Hasan||c Dravid b Sharma||4|
|Shakib Al Hasan||c Dhoni b Zaheer||34|
|Mushfiqur Rahim||lbw b Sharma||30|
|Mohammad Mahmudullah||not out||96|
|Shahadat Hossain||st Dhoni b Ojha||8|
|Shafiul Islam||c Dravid b Sharma||9|
|Rubel Hossain||b Harbhajan||4|
|Total||for all out in 73.5 overs||233|
|Fall of wkts||1-0, 2-4, 3-13, 4-44, 5-51, 6-106, 7-127, 8-155, 9-213, 10-233|
|Zaheer 19-3-62-3, Sharma 18-3-66-4, Ojha 16-1-49-2, Harbhajan 18.5-3-48-1, Yuvraj 2-0-6-0|
|India 1st innings|
|G. Gambhir||not out||26|
|V. Sehwag||not out||41|
|Total||for no loss in 13 overs||69|
|Shafiul 2-0-13-0, Shahadat 3-0-10-0, Rubel 4-0-20-0 (nb1), Shakib 3-0-15-0, Ashraful 1-0-10-0|
Source: AFP South Asian Edition