Sterling's previous deal had been set to expire in June 2020, and there had been rumours Real Madrid were preparing to make a move for him if his City contract talks stalled, per Jonathan Smith of ESPN FC.
Sterling expressed his joy at the new deal, saying: "I'm delighted to sign. My development here has been incredible. I felt from the minute I got here it was the right choice for me. It's paid off and I'm really grateful."
Director of Football Txiki Begiristain hailed the extension, with the England international pledging his future to the English champions.
"This is a significant moment for the club. Raheem has improved dramatically in the past two seasons and is now one of the Premier League’s best attacking players. His statistics tell their own story.
He’s quick, strong and excellent in front of goal – everything a modern-day forward needs to excel.
We’re all delighted he has committed his future to City."
Still only 23, Sterling moved to City from Liverpool for £49 million in 2015.
He has flourished under the stewardship of manager Pep Guardiola.
Last season, he played a key role in City's Premier League-winning campaign, netting 18 goals and providing 11 assists in 33 appearances.
Bleacher Report's Dean Jones tweeted further details about the deal:
So far in 2018-19, he has returned seven goals and five assists in 13 appearances in the English top flight and Europe.
City are likely banking on the fact that he can still get even better given his relative youth.
Sterling looks set to remain a star of the Premier League for the foreseeable future, and City have done well to ensure he will remain at the Etihad into his peak years.