Ross Taylor fell 10 runs shy of 300 as New Zealand built a small first-innings lead in the second Test with Australia, only for captain Steve Smith and Adam Voges to turn matters back in the home side's favour with centuries in Perth.
Having closed on 510-6 on day three, Taylor - who began the fourth day at the WACA on 235 not out - helped the tourists to 624 all out, a lead of 65 in reply to Australia's 559-9 declared.
However, Taylor, who had already written his name into the record books as the first New Zealander to score a Test double century against Australia, was unable to become only the second Black Caps batsman to post a score of 300.
Taylor was the last New Zealand wicket to fall, sweeping Nathan Lyon (3-107) to substitute fielder Jonathan Wells, ending his innings on 290 - the highest-ever total by a visiting batsman in Australia.
Joe Burns went for a duck and David Warner (24) fell cheaply as Australia were reduced to 46-2 in response to Taylor's show of endurance, but Smith (131 not out) needed only 140 balls to bring up his 12th Test hundred.
The pace of Voges (101 not out) was steadier, but the 36-year-old, playing at his home ground, also made the most of the favourable batting conditions to register his second Test century as Australia closed on 258-2, a lead of 193.
Although New Zealand had continued scoring at a quick rate early on day four, Taylor soon ran out of partners, Mark Craig going for 15 before Mitchell Starc (4-119) removed Matt Henry for just six and then did for Tim Southee (21), who hit a low full toss straight back into the clutches of the Australian seamer.
Number 11 Trent Boult added a useful 23 before Taylor's 567-minute stay at the crease, which featured 43 boundaries, was finally brought to an end.
The prompt exits of Burns and Warner left Australia on 46-2 but Smith and Voges put a stop to New Zealand's momentum with a partnership that stands at 212.
Smith rarely looked in trouble in an aggressive innings, although he was dropped by wicketkeeper BJ Watling on 96, and brought up his ton by smacking Boult through the covers.
Veteran Voges joined him on three figures with a pull shot for four in the penultimate over of the day, with Smith then hitting three boundaries in the final six deliveries to further Australia's advantage.
The skipper will now need to decide when to declare on the final day, although the manner in which New Zealand have batted suggests victory and an unassailable 2-0 lead in three-match series is an unlikely outcome for Australia.