Upul Tharanga was batting on 20 and Kaushal Silva was on eight.
South Africa declared their first innings at 455-9.
The second and final Test will be played in Colombo from July 24-28.