South Africa lost the wicket of opener Alviro Petersen for a duck as they chased 369 runs for victory in the second cricket Test against Sri Lanka.
Petersen was caught at silly point by Kithuruwan Vithanage as he prodded forward to a length ball from Rangana Herath that turned appreciably to take the edge of his bat.
On a pitch that was assisting the spinners, South Africa were spared further damage when bad light ended play with 21 overs still remaining to be bowled for the day.
Dean Elgar was on 13 and wicketkeeper-batsman Quinton de Kock, promoted up the order, on 21, as South Africa ended the day on 38 for one wicket.
South Africa, who lead the two-Test series 1-0, require a further 331 runs to win on the final day with nine wickets in hand.