Dorsey, 29, is sidelined with a torn left biceps muscle that required surgery. He was injured Aug. 1, but hasn't been ruled out for the season. He is expected to miss significant time after arriving for training camp as the projected starting nose tackle.
The 49ers announced the deal Tuesday afternoon, a few hours after coach Jim Harbaugh's news conference. Dorsey is entering his seventh NFL season out of LSU.
In 16 games with 13 starts last season in his first year with the Niners, Dorsey had 41 tackles and two sacks. By San Francisco's own count, his 100 tackles were a career high.
''Glenn is a true pro who has quickly become a valued contributor to our organization both on and off the field,'' general manager Trent Baalke said. ''He is a quick study and a very good football player that has earned this extension, and we look forward to his future contributions.''
Losing Dorsey was a devastating blow 11 months after 2013 starting nose tackle Ian Williams went down with a season-ending ankle injury in a Week 2 loss at Seattle. Dorsey quickly emerged as a reliable replacement and stabilizing force for the defensive line. Williams is making significant progress now that he has been activated from the physically unable to perform list.
''Obviously, very disappointed for Glenn and him personally,'' defensive coordinator Vic Fangio said after the injury. ''He was in great shape. Played great for us last year. Got better and better for us as the season went on last year and was looking even better this year. I feel bad for him. I feel bad for us that we won't have him for a while. We'll just move on and get the rest of the guys ready.''
Dorsey joins a long list of players on the team's vaunted defense who will be around for the coming seasons, including star linebackers Patrick Willis, NaVorro Bowman and Ahmad Brooks.
AP NFL website: www.pro32.ap.org and www.twitter.com/AP-NFL