Virat Kohli scored his 17th Test century and India added 51 runs to their overnight score to reach 240 for the loss of three wickets before Kohli decided to declare the second innings and set Sri Lanka an imposing 550-run target in the first Test in Galle.
India had taken a 309-run lead over Sri Lanka after bowling out the hosts for 291 in the first innings and instead of enforcing the follow-on, Kohli decided to bat again.
The Indian captain remained unbeaten on 103 and Ajinkya Rahane made 23* when India declared an hour after play began on Saturday.
Kohli had resumed his innings at 74 on the fourth morning of the match and added some quick runs through ones and twos to reach his century. The 136-ball knock had only five boundaries and one six.
Earlier on day three, Abhinav Mukund scored 81 runs and shared a 123-run stand with Kohli before he was dismissed in the final over of the day. Shikhar Dhawan and Cheteshwar Pujara were dismissed early.
Sri Lanka were bowled out for 291 on day three and that gave India a 309-run lead which was further built by the steady stand between Kohli and Mukund.
Kohli was joined by Rahane in the morning and both took the lead past 500 and later declared as soon the captain got his century. The target will be a stiff when for Sri Lanka, who are already without a batsman.
They have only nine wickets to play with as Asela Gunaratne was ruled out of the series after a fractured thumb. He was injured on the first day of the match and will miss the rest of the series and also the ODI and T20Is.