The 30-year-old carried his bat through the Sri Lankan innings to remain unbeaten on 158 as the hosts finished on 287 after stand-in captain Suranga Lakmal won the toss and chose to bat in the first of the two-test series
Sri Lanka opening batsman Dimuth Karunaratne struck a defiant unbeaten hundred on his return to the side to give the hosts a fighting first innings total in the opening test against South Africa on Thursday.
The 30-year-old carried his bat through the Sri Lankan innings to remain unbeaten on 158 as the hosts finished on 287 after stand-in captain Suranga Lakmal won the toss and chose to bat in the first of the two-test series.
South Africa lost opener Aiden Markram to veteran left-arm spinner Rangana Herath to reach four for one at stumps. Dean Elgar and nightwatchman Keshav Maharaj were at the crease.
The hosts' regular captain Dinesh Chandimal has pleaded guilty to a disciplinary breach during the side's second test against West Indies last month and has opted to sit out of the series against South Africa.
The International Cricket Council, the world governing body of the sport, is due to announce a verdict in the case soon.
On a turning surface at Galle, it was fast bowler Kagiso Rabada who did the maximum damage for the touring side with four wickets for 50. Left-arm wristspinner Tabraiz Shamsi, playing only his second test, returned figures of 3-91.
Former pace spearhead Dale Steyn, returning to the South African team from injury having last played a test in January, picked up the wicket of Kusal Mendis for 24 to trigger a mini collapse.
Rabada removed former captain Angelo Mathews and Roshen Silva in the same over as the hosts lost three wickets for four runs to be left reeling at 119-5.
Experienced Karunaratne, back to open the batting for the hosts after missing the West Indies tour due to injury, stitched together meaningful stands with Niroshan Dickwella, who made 18, and Lakshan Sandakan, the duo adding 63 for the last wicket.
The left-handed batsman hit 13 fours and one six during his 222-ball unbeaten knock.
Stumps, Day 1: SA 4/1 after 4 overs. Elgar 4*, Maharaj 0*, trail by 283. Last wicket: Markram 0.— Cricket South Africa (@OfficialCSA) July 12, 2018
SL 287. Rabada 4/50, Shamsi 3/91, Philander 1/28, Steyn 1/54. #SLvSA #ProteaFire pic.twitter.com/r6uPlFI142