The hosts, who began the day at 99-1 in reply to Pakistan's 451, carried their first innings from the lunch score of 174-2 to 252 without further loss by tea.
Sri Lanka trail by 199 runs with eight wickets in hand.
Left-handed Sangakkara -- who turns 37 in October -- was unbeaten on 102, his seventh three-figure knock in the last 14 Tests, taking his overall tally to 37 centuries.
Jayawardene, set to quit Test cricket at the end of this two-Test series, showed he was good enough to prolong his 17-year career as he survived an anxious start to hit an unbeaten 55.
More From This Section
The tried and trusted duo of Sangakkara and Jayawardene, whose partnership of 624 against South Africa in Colombo in 2006 remains a world record, have so far put on 108 for the third wicket.
Rain reduced play to just 20 overs in the post-lunch session in which Sri Lanka scored 78 runs.
Sangakkara reached his century just before tea by cutting Rehman for his 13th boundary.