Shreyas Iyer came to India's rescue before Sri Lanka crumbled to 86-6 an eventful opening day of the second Test at M. Chinnaswamy Stadium.
India were struggling on 148-6 after Rohit Sharma won the toss and elected to bat first in the day-night match in Bengaluru.
Iyer made a brilliant 92 in tough batting conditions to get his side up to 252 all out as they eye a 2-0 whitewash, Lasith Embuldeniya and Praveen Jayawickrama taking three wickets apiece.
The tourists then slumped to 28-4 in reply and remained in deep trouble at stumps on a pitch that offered plenty of turn from the start, along with variable bounce.
It was Jasprit Bumrah (3-15) and Mohammed Shami (2-18), rather than the spinners, who did the bulk of the damage for India with the pink ball, with Axar Patel taking the other wicket.
India lost four wickets in the opening session, Hanuma Vihari falling for 31 and Rohit removed by Embuldeniya (3-94) prior to Virat Kohli (23) being snared leg before by a Dhananjaya de Silva (2-32) with a delivery that kept so low it gave the former captain no chance.
Rishabh Pant was emphatically cleaned up by Embuldeniya for 39 and Ravindra Jadeja fell cheaply to the same bowler, but Iyer raced to 54-ball half-century and was then dropped by Charith Asalanka.
Iyer played majestically and although he was stumped short of a century off the bowling of Jayawickrama to end the innings, his innings turned the tide.
Bumrah and Shami ensured it was India's day, the former striking a big blow by getting Angelo Mathews caught by Rohit at second slip late on an action-packed day.
Iyer shows his class
While other batters struggled on a tricky track, Iyer gave another demonstration of his class.
The 27-year-old struck four sixes and 10 fours as his positive approach paid off in a knock that could be decisive.
Lethal Bumrah and Shami sparkle under the lights.
Facing Bumrah and Shami is a difficult task at the best of times, but under the lights in these sort of conditions meant the tourists were always going to be up against it.
Shami bowled Dimuth Karunaratne with his first delivery after Bumrah had accounted for Kusal Mendis and Lahiru Thirimanne. Dhananjaya was Shami's second victim, then Axar snared Asalanka before Mathews departed late on.