The 26-year-old defender spent last season out on loan with Championship side Leeds United, making 45 appearances and scoring six times, but is expected to be part of Swans boss Paul Clement's first-team plans for the upcoming Premier League season.
"Personally, the main reason for me wanting to sign a deal was that I feel I have a lot to prove at the club," Bartley told the Swansea website.
"I gained a lot more confidence and experience from my loan spell last season. I feel a better person and a better player. I want to be able to express that on the pitch and fight for a first-team place."
Bartley moved to Wales from Arsenal in August 2012 and has to date made just 16 top-flight appearances for the side.