Sterling moved to Liverpool from QPR in February 2010 and made his debut as a substitute against Wigan in March.
Managing director Ian Ayre said: "This is another positive step forward for the football club in securing the long-term future of one of the country's brightest young talents.
"The negotiations were very positive and both parties acted in a very responsible way to reach an outcome that benefits both Raheem and Liverpool FC.
"Since the summer, Luis Suarez, Daniel Agger, Martin Skrtel, Jonjo Shelvey and Suso have all signed new long-term contracts and it's a clear indication of our intent to keep the players we believe are crucial to bringing success on the pitch.
"It also shows the belief the players have in the vision and leadership of Brendan Rodgers and everyone at this football club."