The move Monday gives San Francisco the right to match any offer sheet the restricted free agents sign with another team or receive a second-round draft pick as compensation.
Brooks had a career-high six sacks last season and tied a franchise record for forced fumbles by a linebacker with four. Brooks was a third-round pick by Cincinnati in 2006 and joined the Niners in 2008.
Baas was a second-round pick by San Francisco in 2005. He has appeared in 76 career games with 38 starts.