South Africa have been set an unlikely target of 490 runs to win the second test and draw the two-match series after Sri Lanka declared their second innings on 275 for five on Sunday.
Dimuth Karunaratne (85), Danushka Gunathilaka (61) and Angelo Mathews (71) scored the bulk of Sri Lanka's runs at Colombo's Sinhalese Sports Club Ground.
For South Africa, who have yet to score 150 in the series, left-arm spinner Keshav Maharaj claimed 3-154 to finish with a 12-wicket haul.
Sri Lanka, who made 338 in the first innings, won the opening test in Galle by 278 runs inside three days.(Reuters)