The left-handed opener's second one-day hundred and an unbeaten 42 from captain Rahul Dravid fired India to 284-8 from 49 overs after they elected to take first strike.
Piyush Chawla, an 18-year-old leg-spinner playing his first one-dayer, then grabbed 3-37 after two early strikes by seamer Zaheer Khan to restrict Bangladesh to 238-9.
Top order batsmen Habibur Bashar (43), Aftab Ahmed (40) and Mushfiqur Rehman (35) led the home team's charge, but failed to build on solid starts at the Sher-e-Bangla national stadium.
Mashrafe Mortaza provided some consolation for 25,000 home fans towards the end with a hurricane 42 off 22 balls that included four consecutive sixes off Dinesh Mongia.
The win helped India erase bitter memories of the World Cup, where they were knocked out in the first round after losing to Bangladesh and eventual finalists Sri Lanka.
The teams now head for the final game in Chittagong on Tuesday with India determined to sweep the series 3-0 ahead of the two Test matches that follow on the three-week tour.
The match was reduced to 49 overs a side as play was delayed by 30 minutes due to light morning showers.
Gambhir anchored the Indian innings and hit 11 boundaries, needing the help of a runner for the last 25 minutes after suffering leg cramps in hot and humid weather.
The 25-year-old narrowly missed surpassing his previous best of 103 against Sri Lanka in 2005 when he was bowled by Syed Rasel in the 39th over, four deliveries after reaching his century.
India, who won Thursday's opening match at the same venue by five wickets, batted with aggression from the start.
Gambhir put on 43 for the first wicket with Virender Sehwag (21) and 87 for the second with Mahendra Dhoni.
Dhoni, who hit a match-winning 91 on Thursday, made 36 before he became the first of left-arm spinner Mohammad Rafique's three victims.
Left-hander Yuvraj Singh smashed a quickfire 24 off 22 balls during a third wicket stand of 44 with Gambhir to propel India to 174-2 by the 32nd over.
India lost four wickets in the last six overs, but Dravid stayed till the end to set Bangladesh a stiff target of 5.8 runs an over.
Both teams made one change from Thursday's game. Chawla, who has played one Test match, made his one-day debut for India in place of seamer Shanthakumaran Sreesanth.
Pace spearhead Mortaza returned for Bangladesh after missing the previous match with a back strain. He replaced seamer Shahadat Hossain.