Colombo, August 24: A magnificent unbeaten century from Tom Latham put New Zealand on course for a lead after Dhananjaya de Silva rescued Sri Lanka with a superb hundred of his own on day three of the second Test in Colombo.
All-rounder Dhananjaya (109) capitalised on some good fortune with a fifth Test century, getting Sri Lanka up to 244 all out at P Sara Oval.
Tim Southee (4-63) and Trent Boult (3-75) did the but bulk of the damage but Dhananjaya held up the tourists, who were only able to bowl 66 overs in the first two days due to rain as they attempt to salvage a 1-1 draw.
Latham then reached three figures for the 10th time in the longest format and the opener was still there on 111, on a pitch offering plenty of turn, when New Zealand closed on 196-4 - trailing by 48.
Dhananjaya ought to have been caught and bowled for nine by Boult on day two and made the left-arm quick pay, playing positively after Sri Lanka resumed on 144 for six.
Ajaz Patel ended a sixth-wicket stand of 41 by pinning Dilruwan Perera leg before wicket, but Suranga Lakmal offered support for Dhananjaya.
Dhananjaya struck spinner Patel for three consecutive boundaries, cutting and driving with conviction and brought up his hundred by striking Southee to the third-man boundary after the seamer removed Lakmal and Lasith Embuldeniya.
Dilruwan made an early breakthrough when the Black Caps started their reply, Dhananjaya taking a slip catch to send Jeet Raval on his way without scoring.
New Zealand were 84-3 with key men Kane Williamson (20) and Ross Taylor (23) back in the pavilion after nicking off to Embuldeniya and Lahiru Kumara respectively, and Dilruwan struck again to see the back of Henry Nicholls following a break for rain.
Latham played with great assurance against the spinners, though, and BJ Watling grew in confidence after an uncertain start.
The composed Latham reached a hard-earned century with a boundary - one of 10 in his brilliant knock - into the leg side off Dilruwan (2-76) and Watling was 25 not out at stumps with New Zealand closing in on a lead.