Fast bowler Dale Steyn took five wickets as South Africa seized control on the third day of the first cricket Test against Sri Lanka in Galle.
Steyn unleashed some fiery bowling without much help from a dry and flat track to finish with figures of 5-50, his 23rd five-wicket haul in Tests.
At stumps, Sri Lanka were 283 for nine, still trailing the visitors by 172 runs with just one wicket in hand.
Sri Lankan skipper Angelo Mathews fought back valiantly with 89 before being bowled by leg-spinner Imran Tahir.
Mathews, who missed scoring his third Test ton on the trot, also shared 71 runs with Rangana Herath for the eighth wicket, the highest partnership of the innings.