Kumar Sangakkara remained unbeaten after a sparkling half-century as Sri Lanka responded well to the challenge of scoring 370 runs in four sessions in order to win the first Test against South Africa on Saturday.
Sangakkara (58 not out) and Kaushal Silva (37 not out) forged an unfinished second wicket partnership of 96 runs to power the hosts to a strong 110 for one by the close of the fourth day's play.
Opener Upul Tharanga (14) began on a positive note before throwing his bat at a ball to edge Dale Steyn and perish caught behind.
Sangakkara joined Silva and went onto complete his 49th Test fifty off 66 balls with seven fours and one six.
Sri Lanka need to score 260 runs on the final day with nine wickets in hand to take lead in the two-Test series.
A brisk half-century from AB de Villiers put South Africa in position to declare their second innings on 206 for six wickets at tea.
JP Duminy was at the wicket unbeaten on eight at the declaration having lost Quinton de Kock in the last over before the break for 36.
De Kock, beaten by the flight, hit back a return catch to off-spinner Dilruwan Perera.
Perera also accounted for the wickets of Hashim Amla for 22 and De Villiers to finish the innings with figures of four for 79.
Amla hit a catch to short mid-on when he flicked Perera off his legs and De Villiers played the ball onto his stumps as he attempted to pull a delivery.
Left-arm spinner Rangana Herath picked up the other wicket to fall in the session, bowling Faf du Plessis for 37 with a delivery that pitched outside leg stump and flicked his off bail.
Herath also grabbed the wicket of first innings century-maker Dean Elgar for 12 in the morning session when the opening batsman nicked one to Dinesh Chandimal as he attempted a drive.
Alviro Petersen was next to go for 32 shortly before lunch when he hit a thin edge to Chandimal off Perera's bowling. The South African batsman was unsuccessful in his challenge of the call.
Earlier in the morning, the tourists made quick work of Sri Lanka's final pair with Herath's 132 minute resistance finally ended by Morne Morkel, who got him to edge a catch to De Villiers at second slip for 19.
Shaminda Eranga, batting with some pain after needing eight stitches in his right hand, was left unbeaten on one.
Steyn finished with figures of five for 54 and Morkel had three for 49 as the hosts were limited to 292 all out.
Image: Kumar Sangakkara hits a boundary
Photograph: Dinuka Liyanawatte/Reuters
Sri Lanka fight back after Elgar's hundred
History beckons as Amla set to become SA's first non-white captain
Cric Buzz: Trent Bridge pitch rated 'poor' by ICC match referee
PHOTOS: England, India finely poised after Ballance ton
Cricket Buzz: Hamstrung De Villiers won't keep wickets in 1st Test