New Zealand were 253-5 at stumps, 118 runs ahead with five wickets in hand, after the stubborn Williamson-Watling partnership recovered the innings from a perilous 159-5.
Williamson was on 80, in sight of his ninth Test century, and Watling was on 48, nearing his ninth half-century.
However, despite their dogged fight, the odds remained in favour of Sri Lanka pulling off a series-levelling win after losing the first Test in Christchurch by eight wickets.
For New Zealand skipper Brendon McCullum, returning to the Basin Reserve for the first time since his match-saving 302 against India a year ago, there were to be no heroics this time.
He was out for 22 while Jimmy Neesham, who scored a century in the India Test, was out for 19.
After McCullum’s departure it fell to Williamson to shoulder responsibility for keeping New Zealand afloat.
He was dropped on 29 and again on 60 in an otherwise cautious innings. His partnership with Watling saw off the second new ball and ensured the Test should extend deep into the fourth day at least.
New Zealand had ended the first day of the Test in charge after making 221 on a bowler’s wicket and reducing Sri Lanka to 78-5 in reply.
Kumar Sangakkara’s imperious 203 on the second day led Sri Lanka to a 135-run first innings lead and gave the tourists the advantage.
Openers Tom Latham and Hamish Rutherford started the New Zealand second innings positively, reaching 75 before their reply was ripped apart in a 30-ball burst that claimed three wickets.
Rutherford could not resist slashing wildly during a barrage of short deliveries outside off and was caught in the third-man trap.
His dismissal unsettled Latham who shuffled around for a few more overs before being caught behind to give Nuwan Pradeep a second wicket. Ross Taylor lasted just seven balls before he was bowled by Rangana Herath.
From 75 without loss New Zealand were quickly 79-3 with the fourth and fifth wickets of McCullum and Neesham following at 122 and 159.
Pradeep, who was omitted from the Sri Lanka line up in the first Test, showed he should not be overlooked on New Zealand wickets with 3-57 to go with his career best 4-63 in the first innings.