The team announced the deal on Tuesday.
Pears spent the past five seasons in Buffalo and started all 16 games the past two years. Pears played right guard in 2014 and right tackle the previous year and will provide some needed versatility for a San Francisco line that lost starting left guard Mike Iupati in free agency.
Pears has spent 10 years in the NFL with Denver, Oakland and Buffalo.
AP NFL website: www.pro32.ap.org and www.twitter.com/AP-NFL