Half-centuries from skipper Angelo Mathews and Niroshan Dickwella helped Sri Lanka post 244 for eight against South Africa in the second ODI in Dambulla on Wednesday.
Both Mathews, who made an unbeaten 79 off 111 balls, and Dickwella, who hit a fluent 69, showed grit against a persistent bowling attack which took wickets regularly after the hosts elected to bat first.
Fast bowler Lungi Ngidi and fellow paceman Andile Phehlukwayo claimed three wickets each.
Ngidi struck twice in his very first over — the second of the innings — to reduce Sri Lanka to 13 for two. He had Upul Tharanga caught behind for nine and then trapped Kusal Mendis lbw for nought.
Dickwella, Sri Lanka's wicketkeeper-batsman, then got going with several valuable partnerships including a crucial 67-run fourth-wicket stand with Mathews.
Phehlukwayo bowled Dickwella when the left-hander dragged a delivery onto his stumps midway into the innings.