The 25-year-old hooker moved to Northampton from Worcester in 2005 and has established himself as a regular England international during his time at Franklin's Gardens.
He has made 144 appearances for the club, scoring 15 tries, and has led the Saints to successive Aviva Premiership semi-finals and a Heineken Cup final since being appointed as skipper.
"I've got a lot of ambition for myself and for the team and want to keep cracking on," he told Northampton's official website.
"I know that I need to keep improving as a player as we've got several good hookers at the club who all want to be playing first team rugby and are knocking on the door.
"I'm delighted and very happy to be staying at the Saints. I've played all my professional rugby here, the club's a big part of my life and I'm happy to continue that.
"The Heineken Cup run last year is an obvious highlight of my time here so far, and Division One was good fun, too. But my whole time here has been a great experience and a learning curve. I've grown up here and it's a home away from home."
Hartley becomes the fifth player to agree a new deal at Northampton in the past two weeks, with England team-mate Courtney Lawes recently penning a fresh three-year deal.
Director of rugby Jim Mallinder is delighted to see his best players committing their future to the club and thinks Hartley can lead the team for many years to come.
"Even though he is just 25 years old Dylan is one of our senior players, and we're now just starting to see him grow into his position as captain," he said.
"He leads the team from the front and never takes a backward step. He is very motivated to make the team succeed and bring the best out of the other players in the squad.
"He is also determined to keep improving as a player. Twenty-five is still young for a front rower, and while Dylan is established in the Premiership and at international level there is plenty for him to learn.
"So we think the best is yet to come from him, and we're delighted that he will be getting better as part of the Saints squad over the next three years."
Gilbert has released a new line of rugby cleats. The Gilbert Virtuo 8S is part of the exciting new product. Check it out.
The entire All Blacks apparel line has been updated for 2013/14. Check out the New Zealand All Blacks polo.
The Nike Tiempo is a solid rugby cleat and one of few styles still made from full-grain natural leather.
The Gilbert Blitz 8S rugby cleat is a great cleat at a great price of $69.99. Get a new pair of cleats today.
A cool looking all black rugby cleat with the high performance adidas is known for. Get in the Gear!
Wear the crest of the British and Irish Lions on your t-shirt. A great look for the summer.
The All Blacks Performance t-shirt is black with hints of blue from the training jersey. Very Cool.
The New Zealand All Blacks training jersey for 2013/14. Get in the Gear!
The USA Rugby Pro Alternate rugby jersey is perfect for any fan of the Eagles. Get yours to wear during the summer Test matches.
The NEW All Blacks 2013/14 jersey has arrived at World Rugby Shop. Dare to wear the colors of the All Blacks.