Resuming on 297-8, New Zealand's tailenders added 53 runs in a chaotic 7.1 overs to post 350, but England's opening pair was bearing down on that total with a long batting lineup still to come.
Cook was on 71 at the break and seemingly not content with just passing mentor and close friend Graham Gooch's national record of 8,900 test runs. He achieved that soon after lunch, when he pushed a firm drive through the covers for four to move onto 33 for the innings and 8,902 overall.
The England captain waved his bat to the crowd, received a standing ovation and was embraced by Lyth, who is making his own mark on this test.
Playing on his home ground, the Yorkshire opener struck his maiden test fifty in his third England appearance and was looking in good nick on 80. One of England's problems areas has been finding an opening partner for Cook, and Lyth's breakthrough is a huge bonus for the team with a five-test Ashes series looming.
England trails by 187 runs.
Earlier, New Zealand's bowlers cut loose with the bat under blue skies, frustrating England's attack and continuing the free-scoring approach of the opening day.
Stuart Broad took the Black Caps' last two wickets, removing Matt Henry (27) and Trent Boult (15), for figures of 5-109 — his 13th five-wicket haul in tests.
Mark Craig was left stranded on 41 , and New Zealand's innings ended with the team having scored 51 fours and six sixes — a stunning boundary rate in the test format.
Henry smashed a four and a six before misjudging another heave and edging Broad to wicketkeeper Jos Buttler.
Craig and No. 11 Boult had a 40-run stand for the final wicket. Boult (15) produced an uppercut shot over the slips for four off Broad, before picking out Lyth at point.
England leads the two-test series 1-0 after its victory at Lord's. New Zealand hasn't lost any of its last six test series.
Starc removes Cook but England new boys hold firm