Jayawardene, 37, hit 13 fours and a six in his unbeaten 138-ball 101 to consolidate the Sri Lankan innings after they had lost three wickets in the morning session on a docile track at the SSC ground.
This was Jayawardene's 11th century at the ground, the most by any batsman at a single venue.
The stylish right-hander, due to retire from Test cricket next month, also shared 99 runs with opener Kaushal Silva (44) and another 97 with skipper Angelo Mathews, who was batting on 48 at the break.
Earlier, fast bowler Dale Steyn, the star of South Africa's big win in the first Test at Galle, sent back opener Upul Tharanga and big-hitter Kumar Sangakkara for a duck in his sharp four-over opening spell.
Also Read
Part-time spinner Jean-Paul Duminy accounted for the third wicket to fall in the morning, dismissing Silva for a well-made 44 after Sri Lanka had won the toss and opted to bat.
Tharanga started off confidently, driving Steyn to the cover boundary in the first over of the day and smashing Vernon Philander straight down the ground for another four.
Steyn (2-48) struck again off the very next ball to dismiss Sangakkara, much to the disappointment of home fans.
The prolific left-hander tried to pull a short delivery, but succeeded only in top-edging it tamely to square leg where Imran Tahir took an easy catch.
Sri Lanka would have been in deeper trouble but Alviro Petersen dropped Silva on 10, failing to judge which way the ball was going while fielding in the slips, with Philander being the unlucky bowler.
He hugged Mathews on reaching the three-figure mark and waved to the fans while fire-crackers were set off near the stands.