Sri Lanka's formidable battery of tireless spinners bowled them to within five wickets of a 2-0 series sweep over South Africa as the tourists continued to struggle against the turning ball in the second and final Test on Sunday.
Chasing an improbable target of 490 to level the series, the tourists finished day three on 139-5, their highest total in the spin-dominated series, at Colombo's Sinhalese Sports Club Ground.
Theunis de Bruyn was batting after a gallant 45, showing the kind of application and positivity that were lacking in his colleagues. Temba Bavuma was on 14 at the other end.
Sri Lanka resumed day three on 151 for three, an overall lead of 365 runs against a South African side who have yet to score 150 in the series, and decided to allow Angelo Mathews to bat himself into form.
The other overnight batsman Dimuth Karunaratne continued his strong run of form to score 85, his fourth 50-plus knock in as many innings, before falling to Lungi Ngidi.
Mathews made 71 before being dismissed by South Africa's left-arm spinner Keshav Maharaj who finished with a 12-wicket match haul.
Sri Lanka captain Suranga Lakmal soon declared on 275 for five, before unleashing his three-pronged spin attack who blew away the top half of the South African batting line-up.
Dilruwan Perera enjoyed an eventful 36th birthday as he first spilled Dean Elgar and then twice dismissed the opener off no-balls before the finally sending him back for 37.
Rangana Herath bowled Hashim Amla with his drift and turn and Akila Dananjaya struck double blows when he dismissed South Africa captain Faf du Plessis (seven) and the scoreless Maharaj off successive deliveries.
Lakmal, the lone paceman in the Sri Lanka attack, did not bowl himself in the first innings and has yet to roll his arm in the second as his spinners wreaked havoc against the leaden-footed South Africans.
PHOTOS: SRK, Dhoni, Katrina add glamour to Poorna Patel's big day
Ishant Sharma on how he has matured as a cricketer
Dravid backs Pant to do well in Test cricket
India has an accomplished bowling attack: Zaheer
'Depleted India might just get the best out of resources available'