Latham was 57 not out, Williamson 71 not out and New Zealand was 175-1 at the break, replying to Sri Lanka's first innings of 282.
The half centuries were a study in contrasts; Latham had to toil for 169 minutes and face 123 balls to raise his 16th half century in tests while Williamson reached his 29th at better than a run a ball, from 45 deliveries in 93 minutes.
Both players hit six boundaries but their approaches could not have been more different. Latham worked laboriously to overcome a recent loss of form and his attacking shots were sprinkled sparsely among a long and difficult innings.
Williamson hit boundaries from the first three balls he faced and later brought up his 50 with a four from the bowling of Suranga Lakmal.
Williamson's innings was also a continuation of his recent good form: he made 89 and 139 in New Zealand's previous test against Pakistan to help it to a 2-1 win in the three-test series.
Latham had only one half century in the Pakistan series, in which he tallied only 99 runs in six innings. But he showed determination on Sunday to occupy the crease and force his way back into form in home conditions.
The pair helped New Zealand recover from the ill-timed fall of Jeet Raval (43) to the last ball before lunch. Latham and Raval had produced a solid 59-run opening stand before Raval was caught behind with the safety of lunch in sight.
The Sri Lanka bowlers were accurate and sometimes taxing on a wicket which has dried out a little and was becoming almost ideal for batting. Clear overhead conditions also reduced the influence of swing, which New Zealand had used to its advantage when it bowled after winning the toss on the first day.
Sri Lanka had been 9-3 after four overs but recovered with the help of Dimush Karunaratne (79) and Angelo Mathews (83) to reach 275-9 by stumps. Its innings lasted a further three overs on Sunday before Lahiru Kumara was the last man out. His dismissal left Niroshan Dickwella unbeaten on 80, after a fighting rearguard innings which further revived the Sri Lanka innings.
Tim Southee, who claimed the last wicket, ended with 6-68 — his first five-wicket bag on the Basin Reserve.
Tim Southee took 6-68 as New Zealand dismissed Sri Lanka for 282 Sunday on the second day of the first cricket test at the Basin Reserve.
New Zealand suffered a setback when it lost opener Jeet Raval for 43 to the last ball before lunch, leaving the hosts at 59-1 at the break and 223 runs behind Sri Lanka.
Tom Latham made a laborious 15 not out from 68 balls and will be joined by captain Kane Williamson after the interval.
Southee had completed his first five-wicket bag in 11 tests on the Basin Reserve on day one when Sri Lanka was 275-9. He claimed the last wicket of the innings within three overs on Sunday, sharply improving his record at the ground where he had previously averaged 46 runs per wicket with a best of 3-24 against the West Indies.
Tailender Lahiru Kumara was the last man out, caught at leg gully by Colin de Grandhomme after squirting a delivery from Southee between his legs to the close-in fielder who dived forward to take the catch.
Wicketkeeper Niroshan Dickwella finished 80 not out after playing a leading role in Sri Lanka's fightback from 9-3 early on the first day. A 133-run fourth wicket partnership between Dimuth Karunaratne (79) and Angelo Mathews (83) rebuilt the innings and Dickwella took the fight to the New Zealand bowlers with a half century from 59 balls.
He hit 11 fours in an attacking innings which helped lift Sri Lanka to parity at the end of the first day.
New Zealand appeared to have regained the upper hand when Raval and Latham compiled a half-century opening partnership from 126 balls. But Raval's rash stroke immediately before lunch off a wide delivery from Kumara (1-11) brought the teams back on terms.