India, resuming the day at 344 for three, went on to declare at 622 for nine post tea, thanks to half centuries from Ravichandran Ashwin (54 off 92), Wriddhiman Saha (67 off 134) and Ravindra Jadeja (70 not out off 85).
Overnight centurions Cheteshwar Pujara (133) and Ajinkya Rahane (132) could not add much to their overnight score.
In reply to India's mammoth total, Sri Lanka were left reeling at 50 for two at stumps with Ravichandran Ashwin taking both the wickets.
"The Bounce is quite variable. Some balls are bouncing and few balls are keeping low. We knew that if they play sweep shot its good for us we have the chance to get wickets," said Rahane after close of play.
More From This Section
"But it's not easy for batsmen playing on this wicket. Tomorrow will be key to our bowlers to bowl in right areas for long period of time."
He further said the team is not thinking of enforcing the follow on yet.
"Yes, the wicket is turning and it is not easy for batsmen. But for the bowlers, we have to bowl well and get their eight wickets. Let's see, we will wait and see tomorrow," Rahane added.
Ashwin, especially, looked well and truly back in his elements and bowled brilliantly to the left-handers.
He dismissed opener Upul Tharanaga for a duck as the southpaw whipped one straight into the abdomen of Rahul, who did well to latch on to the ball.
Skipper Dinesh Chandimal (8) came to the crease and looked aggressive while batting alongside Kusal Mendis (16) as Sri Lanka avoided further loss until close of play.
Earlier, the middle and lower order fired to take India beyond 600.
Ashwin, batting at number six, struck his 11 Test fifty on his way to becoming the fourth Indian to complete a double of 200 wickets and 2000 runs.
He also became the fourth quickest in Test history to get to the milestone in 51 Tests, after Ian Botham (England, 42 Tests), Kapil Dev (India, 50 Tests) and Imran Khan (Pakistan, 50 Tests).
At the other end, Saha looked to attack as well, but he was stumped off Rangana Herath (4-154) in the 153rd over. It was the first instance of six half-centuries in one innings in a Test on Lankan soil and the second time for India after 2007 at the Oval.
It brought Mohammed Shami (19) to the crease who also threw his bat around. Jadeja-Shami put on 30 quick runs for the ninth wicket. Shami was last man out, caught at deep mid- wicket off Herath again. Umesh Yadav remained unbeaten on 8 as India crossed the 600-mark in the 156th over.
But he couldn't build on it, as Herath bowled him in the 122nd over. Thereafter, Saha and Hardik Pandya (20) put on 45 runs for the seventh wicket.
Both batsmen survived DRS reviews for lbw, and took India past the 500-mark in the 134th over. The visitors thus became the first team to score 500-plus runs in successive Tests on Lankan soil.
Pandya was caught at long -off off Malinda Pushpakumara (2-156). But Saha carried on and put on a resolute 57-run unbeaten partnership with Jadeja.
In doing so, he scored his 5th Test half-century off 113 balls and brought up India's 550 just before the tea break.
Sri Lanka were dealt some bad news in the morning when pacer Nuwan Pradeep (0-63) was ruled out of the remainder of the Test.
The pacer had injured his hamstring on day one and consequently the hosts have been left without a proper fast bowler in their attack for this game.
Even so, Pujara (overnight 128) couldn't take advantage of this situation as Karunaratne (1-31) trapped him lbw in the second over of the day. The bowler needed DRS review to get the dismissal in his favour.
The latter though continued batting resolutely and helped India across 400 in the 106th over. In doing so, he also brought up the 50-partnership with Ashwin for the fifth wicket off 84 balls.
Rahane looked set for a bigger score, but then against the run of play, he was out stumped off Pushpakumara in the 111th over. It was the first Test wicket for the debutant in his 100th First Class match. Overall, Rahane faced 222 deliveries and hit 14 fours.