The pair came together with the score on 50 for five and Sri Lanka in dire straits as they responded to New Zealand's total of 221.
They guided the hosts to 105 without further loss at lunch and they continued their fine form after the break to reach tea on 190 for five.
Theirs was a mature innings, combining patience with a number of fine shots without taking any unnecessary risks.
Mathews was especially impressive, his unbeaten 76 coming off 134 deliveries and including 12 fours and one six.
Jayawardene was 68 not out off 129 balls and including eight fours and a six.
Tim Southee had taken three wickets as Sri Lanka made a woeful start to the day with the removal of Tharanga Paranavitana for nought, meaning both openers had departed having scored a duck.
Resuming on seven for one, Southee produced a full delivery which was moving away from the left-hander who got a thick inside edge on to his leg stump.
Southee continued to torment the hosts and in the eighth over almost took his second victim of the day when Suraj Randiv was dropped by Brendon McCullum at a good height.
However, that was merely a reprieve for the batsman who, from the very next ball, got a thick outside edge on a swinging delivery only to find Martin Guptill at second slip, and this time there was no fumbling.
Randiv had made just nine and Sri Lanka were 18 for three.
Just four deliveries later and Kumar Sangakkara was out, as he also got an outside edge to McCullum, the fielder holding on this time with the batsman making just five.
Jayawardene and Thilan Samaraweera attempted to stabilise the innings but again Southee struck, removing the latter for 17, the batsman not even offering a shot after the New Zealander's delivery came back in.
Mathews came to the crease and alongside Jayawardene allowed the hosts to progress with relative serenity to lunch.
In the first hour after the break they scored 55 between them and by tea they appeared ready to steer the hosts past the visitors' total.
Follow us @SprtNationalUAE