LIVE SCORING
Earlier a half-century by AB de Villiers took South Africa into what could prove to be a valuable lead.
South Africa were 257 for five at tea, a lead of 77 after Sri Lanka were bowled out for 180 in the first innings.
On a day when batsmen continued to struggle on a difficult pitch, De Villiers made 56 not out. He shared an unbroken sixth wicket partnership of 84 with Ashwell Prince (38 not out).
Star South African batsmnan Jacques Kallis was the most notable victim of a pitch with uneven bounce.
Shortly before lunch he ducked into a bouncer from Dilhara Fernando, which barely rose above stump height, and took a heavy blow on the left earpiece of his batting helmet.
He collapsed next to the pitch but after receiving treatment for seven minutes he carried on batting.
He was on 25 when he was hit, on 27 when he was dropped by wicketkeeper Kaushal Silva off Fernando and was out for 31 shortly after lunch, caught at third slip off Chanaka Welegedera.
Silva also dropped Prince, on 26, when the batsman got a thick edge to an attempted cut off left-arm spinner Rangana Herath. Prince earlier survived a chance to Thisara Perera at backward point off the luckless Fernando when he was on 23.
Perera struck two important blows for the tourists in the morning, having Hashim Amla (18) and Jacques Rudolph (44) caught in the slips.
But he was struck for three fours in an over by Kallis soon afterwards. Kallis looked South Africa's most accomplished batsman before his injury.
Rudolph, batting with a splint on his left little finger after suffering a dislocation while fielding on Thursday, battled for 229 minutes and 140 balls for his 44.
De Villiers was
more watchful than usual but picked up the pace with a flurry of strokes
which took him to his half-century off 91 balls.