(CNN) -- Sri Lanka piled up the highest Test score on Indian soil to leave the home side battling to save the opening match of the series in Ahmedabad.
The tourists declared on a massive 760-7 on the fourth day for a first-innings lead of 334 runs, and India reached stumps on 190-2 in their second knock.
Left-arm fast bowler Chanaka Welegedara struck a vital late blow when he dismissed Rahul Dravid for 38, but nightwatchman Amit Mishra (12 not out) helped opener Gautam Gambhir (74) survive the final five overs on Thursday.
Resuming on 591-5, Sri Lanka made India's bowlers toil further as former captain Mahela Jayawardene progressed from 204 to 275 and became only the ninth player to pass 9,000 runs in Tests.
He was bowled soon after lunch by leg-spinner Mishra, having added a world-record 351 for the sixth wicket with his unrelated namesake Prasanna Jayawardene.
Prasanna moved from 84 overnight to register his second Test century, first edging a boundary that fell just short of wicketkeeper Mahendra Singh Dhoni and then reaching three figures with another to third man in the same over.
He was left unbeaten on a career-best 154 when the declaration came after Dammika Prasad holed out to Mishra in the deep off Harbhajan Singh for 21.
India made a positive start in reply, with Gambhir and Virender Sehwag putting on 81 for the first wicket from only 17 overs.
However, the dangerous Sehwag fell to left-arm spinner Rangana Herath in the first over after the tea interval, having made 51 from only 67 deliveries.
He had crashed his seventh boundary to reach his 19th Test half-century but his attempt to follow it up saw him edge a catch to Angelo Mathews at mid-on.
Gambhir and Dravid then added another 88, with the latter continuing the fine form he showed in scoring 177 in the first innings.
However, Dravid's fluent 66-ball innings was cut short when Welegedara trapped him leg before wicket.
The breakthrough came as a big relief for Sri Lanka, as world Test wicket record-holder Muttiah Muralitharan had struggled to make an impact, conceding 56 runs from his 14 overs of spin.
Muralitharan goes into the final day still needing 14 wickets to become the first bowler to reach 800 victims.