The deal is worth up to $30.8 million, according to a league source, and includes a $7.65 million signing bonus.
Gilbert, the only Steelers offensive lineman to start every game last season, dropped 10 pounds in the offseason so he could move better. The 6-foot-6, 320-pounder solidified his hold on his starting job by standing out at training camp. His new deal puts Mike Adams' long-term future with the Steelers in question.
Adams, the Steelers' second-round draft pick in 2012, never mounted a challenge to Gilbert or starting left tackle Kelvin Beachum at camp, and he is battling Guy Whimper for the No. 3 job at offensive tackle.
Gilbert is the second player the Steelers have signed to a long-term contract since general manager Kevin Colbert said the organization was "open for business" until the start of the regular season.
Colbert said at the beginning of training camp that the Steelers were interested in re-signing Gilbert, outside linebacker Jason Worilds, cornerback Cortez Allen and kicker Shaun Suisham to new deals since all are starters who were going into the final year of their respective contracts.
The Steelers re-signed Suisham a couple of weeks ago, and they have until Sept. 7, when the regular season starts, to re-sign Worilds or Allen or both.
Gilbert, a second-round pick in 2011, has started 34 of 35 career games, and he is among the players the Steelers will build around up front. He is the second offensive lineman to sign an extension with the Steelers in the past two months.
The Steelers signed Pro Bowl center Maurkice Pouncey to a five-year, $44 million contract in June, making the fifth-year veteran one of the highest-paid players at his position.