MILWAUKEE -

Chris Carter hit his 37th home run, matching his career high and Scooter Gennett sliced an opposite-field, two run homer to help the Milwaukee Brewers avoid another sweep at Miller Park by the Pittsburgh Pirates with a 2-1 win Thursday night.

Pittsburgh entered 3 1/2 games back of New York, St. Louis and San Francisco, all tied for the NL wild-card lead.

Chase Anderson (9-11) allowed four hits in 5 2/3 innings, including a fifth-inning home run by Francisco Cervelli, his first since last Sept. 30.

He improved to 3-1 in five starts this season against the Pirates, who had won their prior six games at Milwaukee.

Tyler Thornburg pitched the ninth for his 12th save in 17 chances.