Sri Lanka were in deep trouble at 50-5 following fast bowler Tim Southee’s three-wicket burst in the morning before posting 247 in their first innings in reply to New Zealand’s 221.
The tourists reached 35-1 in their second innings at stumps after losing hard-hitting opener Brendon McCullum, caught by Nuwan Kulasekara off left-arm spinner Rangana Herath who was pressed into the attack after three overs.
The match is evenly poised at this stage, with New Zealand nine runs ahead with as many wickets in hand.
Skipper Jayawardene and vice-captain Angelo Mathews (79) earlier propped up the innings with a 156-run stand for the sixth wicket.
The hosts looked like gaining a big lead when they reached 206-5 but lost their last five wickets, including those of well-set Jayawardene and Mathews, for 41 runs.
The tourists, who went wicketless in the afternoon, came back strongly to take five wickets in the last session, with off-spinner Jeetan Patel striking three times to finish with 3-55.
Jayawardene looked set to complete his 32nd Test century when he was caught behind while trying to sweep Patel. He hit one six and 11 boundaries in his 176-ball knock.