The 28-year-old France playmaker was only seven months into a five-year deal having joined from Marseille for $21.89 million in the summer, but had been a reported $77.37 million target for an unnamed Chinese club.
Such has been Payet's impact for the Irons, the east London club moved to ensure he will not be easily lured elsewhere.
A club statement on the official website read: "West Ham United are delighted to announce that Dimitri Payet has signed a new long-term contract with the club.
"The outstanding France playmaker, who has made a huge impact in claret and blue since arriving from Marseille last summer, has penned a deal until the summer of 2021.... and is delighted to have pledged his long-term future to the club."
West Ham manager Slaven Bilic had earlier on Thursday talked of his desire to keep Payet as an integral part of the squad.
"Both parties have the intention to stay at West Ham. When you are playing like he is playing many clubs are showing interest, but we are going to do everything we can to keep him with us," he said.
"Every player has a price but the good thing is he is happy at West Ham, we are more than happy with him and I hope - and I really think - that he will play with us for a long, long time."
Payet will be in the Hammers side which travels to Norwich City this weekend, but Bilic has a host of new injury worries after the midweek extra-time FA Cup replay win over Liverpool.
Defenders Winston Reid and Joey O'Brien are to undergo scans on hamstring injuries, while midfielder Cheikhou Kouyate will miss the trip as he was knocked unconscious during the last-gasp 2-1 victory.
Centre-half James Tomkins will also miss out after a scan showed the calf injury he suffered at Southampton last weekend will sideline him for around five weeks.
"We will know how long Winston and Joey will be out after the scans," Bilic added.
"With Tomkins out, we are without three defenders, so in that department it's not a great situation.
"Kouyate is okay, he is doing well but because of the rules he cannot play because he was unconscious.
"We have a few other knocks, but to be fair we have a good feeling.
"Physically and psychologically Liverpool was a long game - 120 minutes drains you. But when you go through, it's almost like pre-season - you don't feel fatigue. You feel good and you are looking forward to the next game."
West Ham joint-chairman David Sullivan later posted an open letter on the club's official website to welcome Payet's new deal.
The Irons have pledged to retain all of their key men as they prepare to move into the Olympic Stadium from the start of the 2016-2017 campaign.
"In line with our normal policy, we review the contracts of players who are doing exceptionally well for the club and reward and extend them when the opportunity arises," Sullivan said.
"Up to now, Dimitri has been our star player this season and to reward him and to show the supporters our unwavering commitment to building a team we can all be immensely proud of, the board has awarded him an improved and extended contract until 2021.
"His technical ability, his ball skills, his strength, his goals, his assists and his attitude have all combined to give us one of the most exhilarating players I have seen in a West Ham shirt in many, many years.
"I have been watching West Ham since the early 1960s and have seen some fantastic footballers in claret and blue - Trevor Brooking, Alan Devonshire, Paolo Di Canio, Carlos Tevez among them - and Dimi has the talent to be considered among the very best.
"Of course, even more exciting is that Dimi's best in a West Ham shirt is still to come. Just imagine what we can achieve, with him in the team and the club moving into a fantastic new 54,000-capacity stadium in the Queen Elizabeth Olympic Park this summer.
"Before then, we have 13 Barclays Premier League games to play and are in a good position, sixth in the table and with a chance of qualifying for Europe.
"Today's news means Mark Noble, Winston Reid, Diafra Sakho, Aaron Cresswell, James Tomkins, Adrian, James Collins and now Dimi have all signed new long-term contracts in the past year - all confirmation that we want to keep our best players here for as long as possible."