Cardiff City manager Neil Warnock has signed a new deal to remain with the club until 2020.
Warnock, who was appointed in October 2016 and has led the team to second place in the Championship, would have been out of contract in the summer.
Chairman Mehmet Dalman held talks with the 69-year-old after flying in to watch the Bluebirds beat Bristol City.
Assistant Kevin Blackwell and coach Ronnie Jepson have also agreed new deals to remain in the Welsh capital.
"After positive talks, I am very pleased that Neil has committed to Cardiff City Football Club for a further two seasons," said owner Vincent Tan.
"Having supported Neil since his arrival at the club, we have been delighted to see results follow on the pitch. We are very happy to have agreed this deal, and are looking forward to continuing to bring further success to Cardiff City.
"We were also pleased to strengthen the team in the recent January window, and wish Neil and the entire squad much success in the games ahead."
CEO Ken Choo said: "I'm sure I speak for all fans of the club when I say that we are thrilled to see Neil put pen to paper on a new contract.
"Neil has had a fantastic impact here in the Welsh capital and we know that he has all of the attributes and experience to continue the great work that he has already put in. I'm very much looking forward to the next two campaigns with him at the helm."
BBC Radio Wales football correspondent Rob Phillips: The job Neil Warnock has done at Cardiff City is little short of miraculous.
Whatever happens at the end of this season, Warnock's influence has been astonishing.
Warnock may be criticised for his team's style but with relatively little spending, he has transformed the team from strugglers to promotion contenders.
It is difficult to think of a manager who has better understood the DNA of Cardiff City.
His rapport with the fans has helped many to reconnect with the club after the trials and tribulations of the rebrand.
He has fostered relations with Cardiff's owners and at boardroom level and he has also engendered a team spirit which has taken the squad to heights few could have predicted.
Despite a few suggestions otherwise, If Cardiff go up, Warnock will enthusiastically take on the challenge of proving himself in the Premier League.
And if they don't - there's no-one better to lead another attempt at returning to the top flight.