That left India 319 for five, 501 runs ahead. Captain MS Dhoni (16 not out) and Yuvraj Singh (15 no) saw the visitors through to the close.
In a circumspect start Gambhir, who began the day on 28, took 75 balls to reach his 51, which included seven boundaries.
But he upped the tempo after morning drinks, finding the rope a further five times and hitting a six off O'Brien to be on 96 by lunch as the Indians ended the morning session on 170 for one, 352 runs ahead.
The opener brought up his second ton in as many Test matches, and his sixth overall, in the second over after lunch, sending Southee's first ball after the break out to the boundary rope.
watch Cricket live streaming on
Link 1: watch Cricket live streaming
Link 2: watch Cricket live streaming on
watch Cricket online
Link 3: Watch Cricket Live
Link 4: Watch CricketOnline