The news was first reported by The Athletic.
Gonzalez is 7-11 with a 4.57 ERA in 27 starts this season. The two-time All-Star is 124-97 with a 3.71 ERA in 11 major league seasons.
He is the second pitcher acquired Friday by the Brewers, who currently occupy one of the two National League wild-card spots. Earlier in the day, Milwaukee acquired left-handed reliever Xavier Cedeno from the Chicago White Sox.