San Francisco currently needs a backup offensive tackle after losing Shon Coleman for the season earlier this summer.
Mills, 28, is a former fifth-round pick of the Bears back in 2013. He spent two years in Chicago before he was released during roster cuts at the start of the 2015 season and later claimed off of waivers by the Cowboys.
Mills had a brief stint with the Lions before the Bills signed him to their active roster. Buffalo re-signed him to a two-year, $4 million contract back in 2017.
Mills was signed this offseason in free agency by the Dolphins on a one-year, $3 million deal. Miami released him with an injury settlement last week.
In 2018, Mills appeared in all 16 games for the Bills and was rated by Pro Football Focus as the No. 70 offensive tackle out of 80 qualifying players.