Aberdeen have announced that manager Derek McInnes and assistant Tony Docherty will stay with the club.
Sunderland had been given permission to speak to the management team as they seek a replacement for David Moyes.
The Dons said on their website they were “pleased to confirm” the duo “have elected to remain at Pittodrie until at least the summer of 2019”.
And McInnes, 45, said: “I feel there is so much still to be done here at Aberdeen.”
Scot Moyes resigned as Black Cats boss following their relegation from the Premier League.
The two clubs agreed compensation, allowing the English side to speak to former Scotland player McInnes, who previously managed in England with Bristol City.
He started his management career at St Johnstone, where he also played, having featured for Greenock Morton, Rangers and West Brom as a midfielder. His two international appearances came in 2002.
McInnes replaced Craig Brown as Dons boss in 2013 and the following year led the club to their first trophy in 19 years by winning the League Cup final against Inverness Caledonian Thistle on penalties. In 2015, the Pittodrie manager and Docherty signed new contracts until 2019.
Aberdeen have finished second to Celtic in the Scottish Premiership three years running and were also runners-up to Brendan Rodgers’ side in the Scottish Cup and League Cup in 2016-17.
Since May’s 2-1 Scottish Cup final defeat, first-team regulars Ryan Jack, Niall McGinn and Ash Taylor have left the Dons under freedom of contract while winger Jonny Hayes is nearing a move to Celtic.
“We have improved season on season and that is not something I’m planning on changing,” said McInnes.
“While we have lost players from last season, they will be replaced by signings of similar quality and our first challenge is to reach the group stages of the Europa League after coming so close in each of the last three seasons,” McInnes explained.
“The recent investment in the club from Dave Cormack, who has rejoined the board, now puts us in an even healthier situation financially and that will allow us to be in a position to take the club to the next stage.”
And chairman Stewart Milne added: “Given what Derek has achieved here, there is inevitably going to be interest from other clubs and in making the decision to stay, he has demonstrated how much Aberdeen Football Club means to him.
“I make no bones about it, it would have been a massive blow to lose Derek at this time.
“We are in the process of rebuilding a strong squad to ensure we continue our on-field progress, we need to deliver the new training and community facilities and subsequently the new stadium.”