India paceman Bhuvneshwar Kumar and opening batsman Shikhar Dhawan have been released from the test squad against Sri Lanka due to "personal reasons", the country's cricket board (BCCI) has said. India declared for 352 for 8 with Virat getting to his 50th global century with a six.
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.
Sri Lanka's premier spin bowler Herath also made an impact - this time with the bat - hitting 67 in Sri Lanka's first innings of 294.
Following up, Bhuvneshwar Kumar (4/8) and Mohammed Shami (2/34) bowled superbly to drag the islanders to the cusp of defeat before bad light stopped play and honours were shared.
The match became even more tense when Shami bowled current skipper Dinesh Chandimal for 20 and Kumar, who returned impressive match figures of 8-96, trapped Niroshan Dickwella lbw for 27.
"Dhawan is available for selection for the third test".
Sri Lanka, 22-4 at one stage, finished on 75-7.
Kohli's ton in the 1st Test against Sri Lanka at Eden Gardens, Kolkata, which came on the back of a duck in the first innings, was his 50th in worldwide cricket.
In his 119-ball knock, Kohli hit 12 fours and two sixes, the second off Lakmal over wide long-off bringing up his century.
India resumed on day five at 171-1 aiming to score quickly to set up a result, but Suranga Lakmal (3-93) slowed the progress with three wickets in his morning spell. The board said the two players had requested the selectors and the team management to allow their release.
Then, with ball in hand, Kumar nearly won it for India.