The 25-year-old's contract includes the option for a fourth year.
"Speaking to the manager and [director of football] Marcel Brands, I had a really good feel for the club and I feel this is a place where I can continue to develop.
"The manager, with his ambition and what he has won in the past, is important and we'll look to push forward and compete with the top clubs. I think a club of this magnitude has all the potential to be right up there."
Birmingham-born Gray left Leicester in January 2021 and signed an 18-month deal with Bayer Leverkusen but he only made 12 appearances for the German side last season, scoring one goal.