The 22-year prop, who was signed from amateur club Rochdale Mayfield six years ago, has made 62 appearances since making his debut in 2017 and would have toured with Great Britain in 2019 but for injury.
St Helens coach Kristian Woolf said: “I am very pleased we have been able to tie down Matty.
“I love Matty’s physicality and toughness. He isn’t the biggest of props but he makes up for it with the way he throws his body around both with and without the ball.
“James Graham has also had a big influence on Matty’s development this year. He has been able to learn from him and has progressed to take on more responsibility, as a starter in the forwards.
“We see Matty as a guy who will progress into a future international and a guy who can lead our pack in the future as one of the number one props in the competition.”
Lees, whose team-mate Morgan Knowles signed a new contract last week, said: “I am made up.
“To be given the opportunity to stay here for another two years is great and I am really looking forward to what the future may hold.
“I am enjoying my time here and it was a no-brainer to stay. The club has been great with me, especially last year with my injury and I now want to repay them in the next two years.”
Listen to The Final Hooter podcast, featuring exclusive interviews, every week. SUBSCRIBE to Love Rugby League on Apple Podcasts.