The 26-year-old had a year left to run on his current deal but will now stay until at least the summer of 2018.
“I’m very happy to be committing my future to Cardiff City Football Club,” the Iceland international told the club’s official website.
“I’ve enjoyed some fantastic times already during the four seasons I’ve been here and look forward to many more as we aim to push on next season and beyond.
“I’d like to thank the City fans for their support and look forward to getting back out there with the rest of the lads for pre-season.
“We’re all going to be looking to hit the ground running and I’m delighted that I’ve been able to sort out my future ahead of returning next month so that my focus can be fully on the task in hand.”
Gunnarsson joined Cardiff in the summer of 2011 from former Coventry and is the Bluebirds’ third longest-serving current player behind Peter Whittingham and David Marshall.
He has made a total of 168 appearances for the club, scoring 18 goals.