Dean Elgar was unbeaten on 102 and Faf du Plessis was on 57.
The second and final Test will be in Colombo from July 24-28.
The wicket of Elgar's opening partner Alviro Petersen was the only success Sri Lanka had in the two sessions where they had used all of their bowlers.
Off-spinner Dilruwan Perera gave Sri Lanka the initial breakthrough by trapping Petersen lbw on the back foot for 34, a decision confirmed after an unsuccessful review by the batsman.