Replying to India's 462, Sri Lanka were bowled out for 284 despite a spirited sixth-wicket partnership of 146 between Dinusha (100) and Niroshan Dickwella (80).
India could not add to their first-innings lead of 178 as dark clouds and the possibility of a storm prompted an early end on Monday.
Earlier, Sri Lanka needed only four balls to take India's final first-innings wicket, but soon found themselves in deep trouble after losing half of their own side in the morning session.
Mohammed Siraj opened the floodgates by dismissing Nishan Fernando for a second-ball duck before India's three-pronged spin attack took control.
Left-arm spinner Manav Suthar (4-76) struck with his first delivery as Dinesh Chandimal (4) edged behind. Lahiru Udara (27) hit six fours before slicing Suthar to backward point.
Shubman Gill then produced a stunning diving catch at extra cover, leaping to his left to send back Kamindu Mendis (14) off Kuldeep Yadav.
The collapse became a full-blown crisis when Ravindra Jadeja had Sri Lanka captain Dhananjaya de Silva caught at slip for 21, leaving the hosts reeling at 5-90.
Dickwella and Dinusha, however, mounted a defiant fightback that frustrated India through the afternoon.
Playing his first test in three years, Dickwella was given a reprieve on 20 when KL Rahul dropped him at slip. He made India pay, combining with Dinusha to deny the visitors a wicket throughout the second session.
Dickwella eventually fell caught behind off Prasidh Krishna, but Dinusha could not be denied his hundred, which he brought up with a single off Suthar.
His splendid innings, featuring four fours and two sixes, ended when Jadeja (3-57) trapped him lbw.
Dinusha, convinced he had got an inside edge, immediately reviewed the decision. But UltraEdge showed no contact, and he walked off shaking his head after a stellar innings.