Durban: Left-arm opening bowler Chanaka Welegedera produced a career-best performance to put Sri Lanka in the ascendancy on the second day of the second Test match against South Africa at Kingsmead on Tuesday.
Welegedera took five for 52 as South Africa were bowled out for 168 on a good batting pitch, giving Sri Lanka a first innings lead of 170.
They added seven more runs for the loss of captain Tillekeratne Dilshan before bad light stopped play.
Sri Lankan century-maker Thilan Samaraweera attributed the astonishing turnaround in his team's fortunes to hard talk and hard work after they were thrashed by an innings and 81 runs in the first Test at Centurion.
"In the last five years I have never seen the team practise so hard," said Samaraweera.
He revealed that the touring players put in two days of hard work in Johannesburg after the Centurion Test ended early, then followed up with another three days of effort leading up to the current Test.
Samaraweera said team management and senior players had rallied the squad.
"We talked a lot after that (Centurion) game," he said.
"We talked honestly. We didn't bat well, although it was a very hard wicket to bat on, and we gave 400 runs. We didn't do well, batting or bowling."
Tuesday's performance gave Sri Lanka hope of gaining their first Test win of the year -- and Hashim Amla, who top-scored for South Africa with 54, admitted that a result was virtually certain if the weather held.
"We have to dig deep and draw on our experience of being in this situation before and coming out on top," he said.
Asked to explain the South African batting collapse, Amla said: "They bowled well and there were some soft dismissals."
But he was unable to pinpoint a reason for the South African team's inconsistency with the bat, which was also exposed in a shared series against Australia last month, admitting: "I don't know."
Welegedera, whose previous best Test figures were five for 87 against Pakistan in Sharjah last month, bowled an impeccable line, slanting the ball across the right-handed batsmen, with all of his victims caught behind or in the slips.
Left-arm spinner Rangana Herath took four for 49 as South Africa crashed to their lowest total against Sri Lanka.
The tourists were earlier bowled out for 338. Samaraweera made a patient 102 and Marchant de Lange took seven wickets on his debut.
De Lange's figures of seven for 81 were the best recorded by any bowler in Test matches in 2011 and put him at the top of an extraordinary crop of eight bowlers who have taken five or more wickets in an innings in their first Test match this year.
Samaraweera became only the second Sri Lankan to hit a Test century in South Africa, joining Hashan Tillekeratne, who made 104 at Centurion in 2002-03.
South Africa reached 22 for no wicket without Graeme Smith and Jacques Rudolph looking in any trouble before Rudolph played a loose hook against Thisara Perera and was caught at long leg by a diving Welegedera.
Welegedera then struck twice, having South African captain Smith caught behind for 15 and Jacques Kallis caught at second slip without scoring.
Hashim Amla and AB de Villiers added 76 for the fourth wicket before Welegedera made another double strike soon after tea to plunge their innings into terminal decline, dismissing De Villiers for 25 and Amla for a fluent 54.
Amla hit 10 fours in an 83-ball innings.
Herath kept the pressure on the batsmen and it needed some bold hitting from tail-enders Dale Steyn and Imran Tahir to enable South Africa to avoid the follow on.