Kohli (108) and the left-handed opener Gambhir (100) added 205 runs for the second wicket as India posted a challenging 304 for three before bowling Sri Lanka out for 254 in the day-night match.
Irfan Pathan, the pace bowler, was the pick of India's bowlers with four wickets, while the off-spinner Ravichandran Ashwin and the paceman Vinay Kumar took three apiece.
Sri Lanka raced to 122 in the opening 18 overs, thanks to their captain Mahela Jayawardene, who kept alive his team's hopes of hunting down a stiff target with a brisk 59-ball 78.
But they suffered a setback when Jayawardene was caught behind off Irfan in the 19th over after smashing two sixes and 10 fours. He added 93 for the second wicket with Kumar Sangakkara (65).
"There were not many boundaries in the Virat-Gautam partnership but they did well to set up a base," said MS Dhoni, the India captain.
"It is a tough ground to defend with a quick outfield. It was difficult when Mahela was batting well. The wicket changed a bit and the ball came on to the bat better and they were able to play their shots."
Sri Lanka's chances receded sharply after the dismissal of Sangakkara, caught at deep midwicket off Ashwin, who also trapped Lahiru Thirimanne (29) lbw in the same over.
Vinay removed Nuwan Kulasekara and Chamara Kapugedera off successive deliveries as Sri Lanka were reduced to 216 for seven, losing four wickets for 20 runs.
"I played a pretty bad shot," said Jayawardene.
"We needed to finish the chase which we did not do. Initially, they set it up nicely with Gautam and Virat and I thought we gave away 15-20 runs [too many]."
Kohli, the man of the match, earlier top scored for India with his second successive hundred against Sri Lanka, having made an unbeaten 133 at Hobart in the recent triangular one-day series in Australia.
"To be able to adjust so quickly from Australia is very satisfying because of the different conditions," Kohli said.
"We [Gautam and I] have got a lot of big stands between us. We understand each others' games really well. We don't have to tell each other what to do. It is very satisfying when the wicket is slow, you have to control your urge to hit a boundary and take the singles."
India plundered 78 runs off the last 7.1 overs, with Dhoni smashing a 26-ball 46 not out and Suresh Raina an unbeaten 30 off just 17 balls. India lost Sachin Tendulkar early in the innings before Gambhir and Kohli bolstered their team with their impressive knocks.
Tendulkar, chasing an elusive 100th international century, could make only six runs before pushing a Suranga Lakmal full-toss straight to Jayawardene in the covers.
Sri Lanka then had to wait for 37 overs to get their next wicket as Gambhir and Kohli continued to gather runs comfortably against both pace and spin.
The pair reached their centuries in the 42nd over before both falling in the next over off the seamer Farveez Maharoof as they attempted to step up the run rate.
Gambhir, dropped on 36, made the most of the chance and hit seven fours in his 118-ball knock, while Kohli also struck the same number of boundaries in his 120-ball innings.