The centre-back, who joined Swansea from Stockport in 2008, had two years remaining on his existing deal which was agreed last year.
But Swansea were keen to hand Williams an extension, and he is now committed to the Welsh side until June 2015.
Williams said of his new deal: "I'm delighted to get it signed. It's dragged on a bit, but I'm happy to finally sign and be part of this team. I'm enjoying it here; it's a great place to be at the moment.
"If we continue to work as hard as we have been, we will continue to go forward as a team and a club."
Williams has led Swansea this season with club captain Garry Monk unable to break through to the first team, and admitted when he joined Swansea, initially on loan, it was not in the expectation the club would reach the Premier League.
At the time, Swansea were chasing promotion from League One, however they are now in their second year among the elite.
Williams told Swansea's website: "I would never have believed it would turn out this way for me or the club. To captain my club, country and play week in week out in the Premier League is what dreams are made of.
"I've enjoyed every year I've been here. It's always been different, normally with a change of manager, but what has stayed the same is the closeness of the squad.
"One of the best things about playing here is the players. They are a great bunch and I look forward to going into training every day."
Source: PA
Source: PA