The 28-year-old Scotland international has been with the Welsh club for four and a half years, having joined from Norwich after a two-and-a-half-year stint at Carrow Road.
A club statement on Wednesday evening read: "Cardiff City are delighted to announce that goalkeeper David Marshall has put pen to paper on a new long-term contract, securing his future with the Bluebirds until the summer of 2018."
Marshall has made 88 saves so far this season - more than any other Barclays Premier League goalkeeper - and has missed just one league game since November 2011.
Manager Ole Gunnar Solskjaer was thrilled to have secured the 10-cap international's services for the next four years.
He told Cardiff City Player: "This is fantastic - we're delighted to have been able to tie David down for the foreseeable future
He really enjoys being at Cardiff City and was very keen to stay with our football club
I was very happy when things were concluded today.
"I think this gives everybody at the club a boost
We know now that we have one of the best goalkeepers in the country committed to us for years to come.
"This is welcome news ahead of Saturday's south-Wales derby and it's great timing for him and us as we look towards the remainder of the season.
"We're trying to build towards the future of course, and David has shown that he's one of the very best
This is a signal that we are serious as to our intentions for the future and that we are committed to keeping the best players here at Cardiff City."
Marshall was equally pleased to have got his new deal tied up in order to be able to fully concentrate on on-pitch matters.
"I'm delighted to have committed my future to Cardiff City," he said
"I've had a fantastic four and half years here already and I'm looking forward to enjoying many more with the club.
"It's a privilege to be part of what we're trying to achieve and the fans have been brilliant to me from day one
We've a lot of hard work left to do this season, but we're a confident group and have plenty of ability and belief.
"Not having my contract to think about any more is a relief and it means I can continue focusing on helping us win football matches."
Source : PA
Source: PA