The 25-year-old DR Congo international joined the Hammers from Olympiakos in 2016 for £6.2m on an initial four-year contract.
Masuaku, who played in the recent Africa Cup of Nations as Congo reached the last 16, has played 75 times for West Ham.
“It was an easy decision and I am looking forward to the season and giving my all for this club,” he told WHUFC.com
The new five year agreement also includes an option for the deal to be extended by a further two years.