COLOMBO - Captain Hashim Amla struck a gritty 139 not out but failed to stop Sri Lanka from taking the driver's seat in the second and final Test against South Africa on Saturday.
Amla, 31, batted for more than eight hours to frustrate the Sri Lankan spinners who shared nine wickets to bowl out South Africa for 282 in their first innings.
Sri Lanka, who made 421 in their first dig, were 0-11 at stumps in their second innings for an overall lead of 150.
Off-spinner Dilruwan Perera (5-69) grabbed a five-wicket haul, his second in five Tests, while left-armer Rangana Herath chipped in with 4-71.
South Africa's weaknesses against spin were left exposed as none of the batsmen, barring Amla, could make a half-century.
"There were phases when the runs dried up, it was tough scoring runs," said South African coach Russell Domingo after the day's play.
"It wasn't easy for us because of the consistency of their spinners. It would have been great if we had scored 100 more runs. 140-odd is a big lead, it's a substantial lead. Sri Lanka are obviously in a very good position," he said.
For Amla, it was his first century as South Africa's Test captain. He faced 382 balls and hit 12 fours in his marathon effort.
His century, also the first by a South African captain in Sri Lanka, helped the visitors avoid the embarrassment of a follow-on.
The South African innings was wrapped up in the final session with Herath having Dale Steyn (30) caught by Kumar Sangakkara and Imran Tahir by Upul Tharanga at deep mid-off.
Perera then sent back Morne Morkel for a duck to bowl out the Proteas with five overs remaining in the day.
South Africa lost Jean-Paul Duminy and Vernon Philander (nine) to spin in the second session when they put on just 71 runs at fewer than three per over.
Duminy (three) fiddled around for more than an hour before he was stumped by Niroshan Dickwella off Herath while Philander was bowled by Perera.
Perera said the defensive approach by the South Africans had failed.
"We thought they were trying to play for a draw. We managed to get a good lead because they batted defensively.
"At the moment, we do not have a target in mind. But if we get about 200 runs more, we will be in a very good position," he said.
Amla, dropped on 93 at short cover by Silva, completed his 22nd Test hundred with a single off Herath, a fitting reward for his lonely toil on the crease.
Herath get rid of AB de Villiers (37) and Quinton de Kock for a duck in the space of three balls in the first session after South Africa had resumed at their overnight 3-98.
South Africa lead the series 1-0 after winning the opener in Galle by 153 runs.