The 19-year-old striker made his Premier League debut as a late substitute in August's 1-0 defeat at home to Stoke, while he has since gained first-team experience on loan at Colchester earlier this season.
After progressing through the club's youth system, Lee made his Hammers debut in January of last year, coming off the bench in an FA Cup replay defeat to Manchester United.
An ankle problem is likely to rule the striker out of action for the remainder of the campaign, but he admitted his joy at the new contract and says he is looking to make an impression next season.
He told West Ham TV: "I'm really happy to sign this new deal and like I said I've been here since a young age, so I only want to play for West Ham.
"I'm happy that I'm here for another few years and I look forward to hopefully playing in the first team.
"All I want to do is play football, so that was the only decision to be made. I believe that I can play for this first team one day and that's the aim.
"It's any boy's dream to play for the first team and I've had two appearances now from the bench and I hope there will be many more to come.
"Once you get a little taste of it, you want more and more. Unfortunately it hasn't worked out for me that way this season, but hopefully next season will be a different story."