Retiring home hero Kumar Sangakkara featured in a brief rebuilding act in his 134th and final Test as Sri Lanka reached 140-3 in reply to India's first innings total of 393 on day two of the second Test.
Sangakkara made 32 as he and Kaushal Silva (51) added 74 runs to help Sri Lanka overcome the early loss of opener Dimuth Karunaratne.
Lahiru Thirimanne was batting on 28 at the close with skipper Angelo Mathews on 19 at the other end with the hosts, who lead the three-match series 1-0, still trailing by 253 runs in the evenly poised Test.
Sangakkara walked out to a guard-of-honour by the Indian team after Umesh Yadav had dismissed Karunaratne with his first delivery at the P Sara Oval.
The first ball Sangakkara faced was a vicious inswinging yorker from Yadav which the left-hander barely managed to dig out.
He also got a reprieve on 24 when Ajinkya Rahane failed to take a catch at slip after Sangakkara had attempted a cut shot off Ravichandran Ashwin.
The Indians soon combined again to dismiss Sangakkara, who got a standing ovation on his way back to the pavilion while his opponents clapped.
Silva was caught behind off Stuart Binny when on 14 but it turned out to be a no-ball and the opener went to notch up his ninth Test fifty before sweeping leg-spinner Amit Mishra to Ashwin at short fine leg.
Earlier, Wriddhiman Saha (56) capitalised on a charmed life to hit his second successive Test fifty as India inched close to the 400-mark before being all out soon after lunch.
Left-arm spinner Rangana Herath claimed the last two Indian wickets to finish with figures of 4-81.
India 393 all out (Rahul 108, Herath 4-81)
Sri Lanka 140-3 (Silva 51, Mishra 1-9)