The Wales international has been on the radar of the Gunners and Sunderland – with the Swans turning down numerous offers since the end of the season.
Williams is a key man for the Welsh side, who enjoyed a Europa League campaign and a comfortable Premier League season last time out.
The 29-year-old is glad to finally get the new deal signed and can now focus on improving the club rather than listening to gossip about his future.
“I respect this club and everyone associated with it, and I love it here,” said Williams.
“I’ve been here for six years, so it’s home for me. I hope to finish my career here – I’ve had that viewpoint for a long time.
“I am very happy here and I’ve enjoyed a lot of success at Swansea.
“I’m delighted to sign this new contract.”
Williams had one year remaining on his current deal but despite big money offers, Swansea never contemplated letting their man go.
The defender may well now spend the rest of his career at the Liberty Stadium as desired.