New Zealand captain Brendon McCullum set the stage for a tantalising conclusion at Dunedin's University Oval with a sporting declaration that offered Sri Lanka more than five sessions to reach a 405-run target.
But the tourists' response was disrupted by three stoppages as southerly squalls swept across the ground. Further showers are forecast for the final day.
At stumps on day four, with an hour's play lost because of the weather, Sri Lanka were 109 for three, requiring a further 296 runs to pull off an epic victory.
Sri Lanka's highest fourth-innings chase is 352-9 against South Africa in 2006 and the highest by any side in New Zealand is 348-5 by the West Indies in 1969.
Also Read
McCullum declared New Zealand's second innings at 267-3 to go with their 137-run first innings advantage.
Sri Lankan openers Dimuth Karunaratne and Kusal Mendis set about building a foundation reaching 54 in the 27th over when New Zealand struck twice.
Southee had Karunaratne, Sri Lanka's top scorer in the first innings, caught behind for 29 and 10 runs later debutant Udara Jayasundera fell to Neil Wagner for 3.
Before his replacement Mathews could reach the crease a hail storm brought play to a halt for the third and final time.
The dismissal of Mendis gave wicketkeeper BJ Watling a New Zealand record ninth catch for the Test.
After New Zealand resumed the day at 171-1, McCullum
called an end to the innings after he belted his second six to equal the world record for the number of sixes hit in Tests.
McCullum was 17 not out when he declared, with the 23-year-old opener Tom Latham unbeaten on 109, having notched up his third Test century.
Kane Williamson, who reached his half century with the second ball of the morning, was out for 71.
It was the 20th time he has passed 50 in all forms of international cricket this year including eight times in Tests.
Latham offered two chances which were not taken and had a nerve-wracking wait on 99 when Sri Lanka challenged a rejected lbw appeal.