The 34-year-old has played 74 Tests since his debut in 2012 and more than 120 games for the Hurricanes.
He said he was never going to play for another Super Rugby team and is looking forward to trying to trying to extend his All Blacks career.
"I'm so grateful to be playing the game I love, and grateful for the opportunity to continue with the Hurricanes and New Zealand Rugby. The Hurricanes have been loyal to me, I'm a 'one club' man, so to continue my career with them will be awesome.
"I'm also looking forward to giving myself a chance to again play for the All Blacks. It's a huge honour to play for that team and I never take my opportunities in the black jersey for granted."
The All Blacks head coach Ian Foster said it was an important signing through to after the 2023 World Cup in France.
"It's fantastic news to have 'Colesy' recommit to New Zealand. He's such an influential player in our team: he's a world-class player, an inspiration to his teammates and we love his straightforward honesty. On behalf of the All Blacks, we want to congratulate him and wife Sarah on his decision."
Hurricanes coach Jason Holland said, "Colesy is massive for our group both on and off the field and has been for many years. His passion for the Hurricanes is second to none and we learn from him every day. His form this season has been top notch and he's been looking sharp throughout Super Rugby Aotearoa."
Hurricanes CEO Avan Lee said, "This is such outstanding news for the Hurricanes and New Zealand Rugby. Colesy is an inspirational leader and adds so much value to our game. We're delighted to have him continue for the Hurricanes for the next two years."
Coles made his provincial debut for Wellington in 2007, Hurricanes debut in 2009 and played for the Māori All Blacks in 2010.
He made his All Blacks Test debut in 2012 against Scotland and was a member of the 2015 Rugby World Cup-winning side.
He captained the Hurricanes to their first Super Rugby title in 2016, and was a nominee for the New Zealand and World Rugby player of the year awards that year. He was also nominee for All Blacks Player of the Year in 2020.