A hobbling Kane Williamson guided New Zealand to 142 for five at the close of play on the third day of the second test against Sri Lanka in Hamilton, with the hosts needing another 47 runs to seal a 2-0 series sweep.

What a moment t would be for Williamson if he gets to yet another Test century on Monday morning against the Lankans. He will also achieve the feat of scoring the highest number of runs in a calender year by a New Zealander. 

New Zealand won the first test in Dunedin by 122 runs, though Sri Lanka are still in with a chance of pinching a win on Monday to draw the series.

Williamson, who was limping noticeably and was seen to have heavy strapping around his right knee, was on 78 while BJ Watling was on nought as they chased the target of 189.

Dushmantha Chameera, who took a career-best 5-47 in New Zealand's first innings with a fiery display of fast bowling, took four wickets in the second before Suranga Lakmal picked up Mitchell Santner for four just before the close.

Chameera gave Sri Lanka a perfect start when he dismissed Tom Latham (four) and Martin Guptill (one) with short-pitched deliveries to reduce the hosts to 11-2.

Williamson and Ross Taylor (35) then settled the run chase in a 67-run partnership before Taylor was caught on the boundary for 35 and then captain Brendon McCullum at mid-off for 18 to send some jitters through the New Zealand camp.

New Zealand were set the small victory target after a surreal period of play after lunch when the hosts took the last seven Sri Lankan wickets for 46 runs in 8.1 overs, bowling them out for 133.

Tim Southee began the collapse when he took three wickets in 14 deliveries to run through Sri Lanka's middle order after they had resumed on 85 for three.

Neil Wagner also grabbed two wickets after lunch before Southee took his fourth when Nuwan Pradeep was caught behind for a three-ball duck to end the innings.

The visitors had been comfortable until about 30 minutes before lunch having cruised to 71 without loss.

Doug Bracewell then grabbed two wickets in an over, dismissing Dimuth Karunaratne (27) and Udara Jayasundera (0) with short deliveries.

Wagner grabbed another wicket in the penultimate over before lunch when he had the dangerous Dinesh Chandimal caught for four at leg gully by Guptill.

The hosts then did more damage after the break, with only some counter-attacking blows from Milinda Siriwardana, who blasted three fours and two sixes in his 18-ball innings of 26, padding Sri Lanka's score. All 10 wickets fell for 62 runs in a little over 80 minutes of play.