The Republic of Ireland international previously joined Sheffield United in July 2018 where he helped the Blades gain promotion to the Premier League in his first season.
Egan made 36 appearances in the Premier League last season helping Chris Wilder’s men secure a ninth place finish.
Moments after signing a new long-term deal, Egan admits his time at Bramall Lane is arguably the best in his career and insists he is looking forward to the future.
"The last two years have probably been the most successful of my career and to get the chance to sign a new contract here is brilliant for me and I'm really looking forward to the future. I need to thank everyone involved.
“I've loved my time here. We won promotion in the first year and had a real good first season back in the Premier League, so now it is about building on that and improving in the future."
Sheffield United head coach Wilder hailed the former Brentford man and insists Egan is part of the team’s success.
"It's a reward for the influence John has on the team and at the football club. He's been part and parcel of our climb over the last two years and he's taken his game to the next level.
"John has been outstanding and knowing the boy as we do, we know John is not a comfortable footballer, he wants to establish himself and continue to improve at the highest level."