The 19-year-old midfielder, who has made 51 appearances for the east London side, has signed new terms until 2024 -- with the option to extend for a further year.
The news will come as a boost to the Hammers, who moved into the top half of the table with a 2-1 win away to Southampton on Thursday, after Rice rejected an initial offer earlier in the season.
Rice's previous deal was due to run out at the end of next term, leading to fears he could leave West Ham for nothing were he to move to a rival club when that contract ran out.
"Signing Declan to a new long-term contract is something we have been planning for and working round the clock on and I, the board, the manager and Declan himself are all very happy that everything has now been completed," said West Ham joint chairman David Sullivan.
Much more to come from on-fire Anderson: Pellegrini
Such is Rice's ability he is being courted by both the Republic of Ireland and England.
The London-born Rice has been capped by the Republic but not in a competitive fixture, leaving the door ajar for a call-up by England manager Gareth Southgate.
But while he ponders his international future, Rice was pleased to have committed his club future to West Ham, a club with a long tradition of nurturing young players.
"I'm absolutely delighted to have got the contract done, signed and to commit my future to the club until 2024. I'm absolutely ecstatic," he said.
"Without a doubt, the plan was always to stay at West Ham. I've had the support from the fans, from the players and from the manager (Manuel Pellegrini) and now, to get it done and commit myself to this club is a very special moment.
"I'm still young, so to put more years on my contract and keep developing here is the best thing for me to do now. With the support of the manager, the players, everyone, it was the right thing to do."
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ