The tourists were struggling at 14-2 in the fourth over before skipper Taylor (119 not out) and Kane Williamson (95 not out) propped up the innings with an unfinished 209-run stand for the third wicket at the P. Sara Oval.
Taylor completed his eighth Test hundred, and his first against Sri Lanka, in the last session when he flicked seamer Shaminda Eranga to deep square-leg for two.
Williamson provided valuable support and looked set to complete his third Test century when play was called off due to rain, with more than nine overs remaining in the day.
New Zealand, shot out for 221 and 118 during their 10-wicket defeat in the opening Test in Galle, staged a more determined performance this time and Taylor led from the front.
The tourists made the most of winning the toss on a good batting pitch as Taylor and Williamson frustrated Sri Lanka with responsible batting against both pace and spin.
The New Zealand captain, who gave a difficult chance on 14 when his edge off Eranga went past Angelo Mathews in the slips, has so far hit 10 fours in his 241-ball knock, while Williamson\'s 229-ball innings included eight fours.
The pair denied Sri Lanka for more than two sessions, taking no risks and patiently waiting for loose deliveries to punish.
Left-arm spinner Rangana Herath, who took 11 wickets in the last Test, was pressed into the attack after 14 overs but failed to break the stand. He has so far conceded 45 runs in his 21 overs.
New Zealand made a poor start, losing openers Martin Guptill and Brendon McCullum in the first four overs.
Guptill was caught by Mathews at first slip in Nuwan Kulasekara\'s opening over. McCullum was unlucky to be given out leg-before off Eranga as TV replays suggested he had inside-edged the delivery on to his pad.
Guptill and McCullum each scored four.
Sri Lanka made one change from the last Test, replacing Dimuth Karunaratne with fit-again opener Tillakaratne Dilshan.
The tourists brought in debutant leg-spinner Todd Astle in place of all-rounder James Franklin.