Middlesbrough have held off strong competition from a number of Premier League teams to keep Matthew Bates at the club.
The 22-year-old Teessider was out of contract this summer and it seemed like he was set to quit the club after shunning Boro's previous offers to extend his deal.
West Ham were leading the chase for Bates and made an offer earlier this month, while Wigan, Bolton, Everton and Sunderland were all keen.
But now Riverside chairman Steve Gibson has helped broker a new three-year deal for Bates, which he has signed.
Chief Executive Keith Lamb said: "We are delighted Matthew has decided to commit his future to Middlesbrough."
Bates would have been allowed to leave Boro under freedom of contract, although given his age the club would have been entitled to compensation, but that would have been way below his market value.
Stockton-on-Tees-born Bates, who has battled back to full fitness after suffering three cruciate knee ligament injuries, shone last season for Boro despite their relegation, featuring in both midfield and defence.