Skipper Kane Williamson and Latham played cautiously and built a stand of 33 runs before Williamson's (20) wicket claimed by Lahiru Kumara.
Ross Taylor and Henry Nicholls played a brief knock of 23 and 15 runs before they were sent back to the pavilion.
Latham scored a ton and playing at a score of 111 with BJ Watling (25*) and both built an unbeaten partnership of 70 runs. New Zealand was at 196 for the loss of four wickets at the end of play on day three.
Earlier, Sri Lanka resumed their batting from 144/6 and added 100 runs to the scoreboard before they were bundled out for 244.
Dhananjaya de Silva and Dilruwan Perera resumed the batting from 32 and 5 runs, respectively. Both stitched a partnership of 14-run for the seventh wicket.
Perera added 13 runs to the team's total before he was found in front of the wickets by Ajaz Patel.
Suranga Lakmal joined Silva in the middle and both added some runs to the scoreboard to get past the 200 run-mark.
Lakmal (10) was caught by BJ Watling behind the stumps off Tim Southee's delivery. Trent Boult bowled Silva and sent back to pavilion to settle Sri Lanka to 244 in 90.2 overs.
For New Zealand, Boult scalped three wickets while Southee took four wickets.