Angelo Mathews batted patiently through the first two sessions of the final day as he tried to lead Sri Lanka to a series-clinching draw with New Zealand in Colombo.
Having won the first Test in Galle by 10 wickets, the hosts were focused solely on not losing this second match in order to earn a 1-0 series win.
Facing a notional target of 363, they began the day in trouble on 47 for four but despite the early run-out of Thilan Samaraweera, which left them 63 for five, Mathews rebuilt in the company of Prasanna Jayawardene.
The pair took their side to 107 for five at lunch and took their partnership to 56 before wicketkeeper Jayawardene (29) edged to opposite number Kruger van Wyk to give leg-spinner Todd Astle his first Test wicket.
Suraj Randiv failed to score but Mathews reached a dogged 178-ball half-century with his fifth boundary, hammered over mid-wicket off Astle, before repeating the stroke next ball.
Nuwan Kulasekara hit Astle for two sixes in an over and Mathews lifted Jeetan Patel beyond the ropes but resistance was still the order of the day as Sri Lanka reached tea on 167 for seven.