Lewis is seen as a future Wales international and has already caught the eye of national team boss Warren Gatland.
Ospreys head coach Lyn Jones said: "Ben has made fantastic progress this season and the new contract is recognition of this.
"He's taken the opportunities that have come his way this season and has stood out in a number of games, making a huge impression on some knowledgeable rugby people.
"He's got a bright future ahead of him, and thankfully, for the next four years we know that it will be with the Ospreys."
Lewis, who combines his rugby with studying a sports science degree at Swansea University, is seen as a long-term successor to Wales open-side Martyn Williams.
He said: "Working with the likes of Ryan Jones, Marty Holah and Filo Tiatia, some of the best guys in the world in their positions in the back row, can only help me develop as a player.
"I think there's an element of poacher turned gamekeeper in my relationship with them though, as I'm not just looking to learn from them but to oust them from the team eventually.
"It's a tough ask but I'm looking forward to the future with the Ospreys."