Galle: After suffering a middle-order collapse, Niroshan Dickwella and Suranga Lakmal got things going for Sri Lanka as they reached 222 for 7 at stumps on Day 2.
They added 66 in 145 deliveries and the pair will resume the Sri Lankan innings on the following day.
Earlier in the day, New Zealand tweaker Ajaz Patel picked five wickets to help New Zealand gain control in the match.
For the visitors, Ross Taylor scored 86 in 132 deliveries as New Zealand posted 249 in their first innings.
Akila Dananjaya and Lakmal were the standout bowlers for the hosts as the duo shared nine wickets between each other.
Mendis reached his half-century with a boundary to the leg-side off Ajaz Patel and a lapse in concentration saw him being dismissed off the very next ball, caught by Taylor at first slip. Patel had claimed all three Sri Lankan wickets to fall by tea.
Mendis' 53 came off 89 deliveries with seven fours and one six. Mathews was unbeaten on 41 off 83 balls with six fours and one six.
Earlier, New Zealand resumed on 203 for five but lost their last five wickets with the addition of just 46 runs.
Ross Taylor was the top scorer in the New Zealand innings with 86. He was dismissed on the first ball he faced on day two when he attempted a cut shot and was caught behind.
Lakmal hardly put a foot wrong on the second day and backed up off-spinner Akila Dananjaya, who finished with five wickets.