Port Elizabeth: Dhananjaya de Silva kept Sri Lanka's hopes alive with a defiant innings on the second day of the first Test against South Africa at St George's Park on Tuesday.
De Silva made 43 not out as Sri Lanka struggled to 181 for seven - still 105 runs behind South Africa's first innings total of 286 - before bad light ended play.
South African new ball bowlers Vernon Philander and Kyle Abbott put the Sri Lankan batsmen under pressure in seam-friendly conditions, with the first three wickets falling for 22 runs.
It looked as though a full-scale collapse was possible but Sri Lankan captain Angelo Mathews made a solid 39 before De Silva came out to bat at number seven and played an impressive innings, with assistance from Dinesh Chandimal and Rangana Herath.
It was not a wholly impressive performance by the South African bowlers. Philander and Abbott both bowled well, taking three for 35 and two for 49 respectively, but rising star Kagiso Rabada had an off day.
Rabada struggled to find his rhythm and conceded 63 runs in 13 overs, although he did take the key wicket of Mathews, caught low down at third slip by Dean Elgar.
De Silva, playing in only his sixth Test, showed some of the quality that has already brought him centuries against Australia and Zimbabwe, although he survived a caught and bowled chance to left-arm spinner Keshav Maharaj when he was on 27. When play ended he had faced 69 balls and hit five fours.
The day started well for Sri Lanka when fast bowler Suranga Lakmal, playing in his 32nd Test, took his first five-wicket haul in Test cricket, finishing with five for 63, as South Africa lost their last four wickets for 19 runs.
The previous Test best for Lakmal, 29, was four for 78 against Pakistan in Dubai in January 2014.
Philander was caught at deep square leg when he top-edged a pull against Nuwan Pradeep in the fifth over of the morning after South Africa had resumed at 267 for six.
Maharaj edged an away swinger to wicketkeeper Dinesh Chandimal to give Lakmal his fifth wicket and Abbott was run out after a mix-up with Quinton de Kock.
Quinton de Kock was last man out for 37, trying to keep the strike and playing across the line of a yorker from Pradeep.
But the hosts hit back almost immediately as Philander and Abbott ripped into their batting. Both gained appreciable movement through the air and off the pitch as three wickets fell in the first eight overs before captain Mathews joined a patient Kaushal Silva to add 39 runs for the fourth wicket.
Silva was the only one of the top four in the Sri Lankan batting order to show a solid defensive technique in tricky conditions. But he made only 16 off 108 balls before he was leg before wicket to Philander, who produced a ball that cut back after a succession of deliveries that left the batsman.
Mathews, who needed treatment after a rising delivery from Philander struck his right forearm early in his innings, made 39 off 69 deliveries before pushing at a ball from Rabada to be caught at third slip.