The club, who are also expected to complete the signing of Aden Flint from Bristol City this week, have made the 23-year-old Northern Irishman their first acquisition of the summer.
"Due to the terms of the deal, the fee will remain undisclosed."
McNair joined the Black Cats in 2016 after a five-year stint at Manchester United. He made 28 appearances in his two seasons at the Stadium of light, returning from injury to score four goals in his last five matches of the campaign.
With Tony Pulis looking to secure Premier League qualification for his new side next season, the young midfielder could prove an important cog in the grand scheme of things.