Chasing an improbable target of 231 in little more than a session, the tourists were reeling on 75 for seven before the umpires ruled the light too poor to continue in the final session of the match.
With rain washing out most of the first two days in the match, it was a stunning comeback from the world’s top-ranked test side who were tottering at 79-6 in their first innings at one stage.
Kohli propped up his side’s batting on the final day with an unbeaten 104 to register his 18th test hundred, and 50th across formats, after paceman Suranga Lakmal’s inspired spell in the first session gave Sri Lanka hope of a maiden test win in India.
India, however, rode out the storm before declaring their second innings on 352 for eight immediately after Kohli hit a six to get to three figures against Sri Lanka, who have failed to win in 17 away tests against the hosts.
India seamer Bhuvneshwar Kumar, who took four wickets in the first innings, picked up another four for just eight runs to take the hosts close to a win but the fading light helped Sri Lanka to avoid a crushing defeat after dominating the match for more than four days.
The 30-year-old Lakmal was the most successful bowler for Sri Lanka in the first innings with four wickets and he returned to haunt the world’s top-ranked side with a triple strike in the second.
After resuming on 171-1, India were cruising before Lakmal got a delivery to jag back off the seam and breach KL Rahul’s defence to dismiss the right-hander for 79.
Lakmal then sent back the dependable Cheteshwar Pujara and Ajinkya Rahane in the same over to reduce the hosts to 213-4.
Dilruwan Perera dived forward to complete a brilliant catch to dismiss Pujara for 22, while Rahane was out leg before without scoring.
Kohli, who appeared unsure of his footwork at the start of his innings, then added 36 for the fifth wicket with Ravindra Jadeja to steady the ship before his partner perished to off-spinner Perera shortly before lunch.
Ravichandran Ashwin and wicketkeeper Wriddhiman Saha fell cheaply to all-rounder Dasun Shanaka, leaving Kohli to wriggle India out of trouble while also looking to add enough runs to take the total out of Sri Lanka’s reach.
The 29-year-old Kohli, who has 32 hundreds in the 50-over format, was given out leg before to Lakmal on 72 but survived on review after replays confirmed a thin edge off his bat.
In his 119-ball knock, Kohli hit 12 fours and two sixes, the second off Lakmal over wide long-off bringing up his century. He went down on one knee and roared in delight with a clenched fist towards the dressing room.
The second match in the three-test series will be played in Nagpur from Friday. REUTERS