By WILL GRAVES, AP Sports Writer

PITTSBURGH (AP) — The Pittsburgh Pirates spent a good portion of the first half of the season trying — and failing — to find any sort of traction.

Once they’d figure out one problem, another would pop up. If it wasn’t the bullpen, it was the mess left by outfielder Starling Marte’s 80-game steroid suspension. Or the back end of the starting rotation. Or the massive funk that baffled star center fielder Andrew McCutchen.

Two hot weeks have changed the discussion dramatically.

Gregory Polanco homered, Chris Stewart added three hits and the surging Pirates completed a four-game sweep of the NL Central-leading Milwaukee Brewers with a 4-2 victory on Thursday.

The Pirates have won 11 of 13 and moved within three games of Milwaukee in a division that’s tightened up since the All-Star break. The Brewers have lost five straight, cutting their lead to one game over the idle Chicago Cubs.

“When you’ve got guys showing up and stars showing up like they did this homestand, good things are going to happen,” said McCutchen, who provided some insurance with an RBI single in the fifth off Jimmy Nelson (8-5). “When we play our best baseball, we can compete with anybody.”

The Pirates focused on pressuring Milwaukee’s defense during the series, forcing the issue whenever it had the chance. They scored three of their four runs by taking risks that paid off beautifully. Adam Frazier singled with two outs in the second and scored on Stewart’s single to right. With the game tied at 2 in the fifth, Stewart led off with a single then moved to second on a sacrifice bunt.

The 35-year-old catcher — who spent time on the disabled list this season with hamstring issues — chugged home from second on a two-out single to right by Josh Harrison. Harrison went to second when right fielder Domingo Santana’s throw missed the cutoff. Harrison then scored on a flare to right by McCutchen.

“I think we want to be in the right position to take that extra step,” Stewart said. “I know there’s two outs so I’m getting a couple extra steps off second base and going on the crack of the bat. We focus on those types of things.”

Jameson Taillon (6-3) struck out a season-high eight in 5 1/3 innings. Felipe Rivero worked a perfect ninth for his ninth save. Pittsburgh is .500 (48-48) for the first time since April 16, two days before Marte’s suspension began.

“I wouldn’t say it’s good to be at .500, but it’s good to be playing good baseball,” Stewart said. “We feel like we’re doing what we thought we were capable of doing.”

Taillon threw career-high 116 pitches before giving way to four relievers that kept slumping Milwaukee. Juan Nicasio worked out of a two-on, one-out jam in the eighth and Felipe Rivero worked a perfect ninth for his ninth save as the Pirates put together their first four-game home sweep since taking four straight from St. Louis in July, 2013.

The Brewers were one of the biggest surprises in baseball during their first half. They took a 5½ game lead into the All-Star break but have seen that all but erased in the span of seven days. The problem isn’t so much the pitching but the offense. Milwaukee has managed just 13 runs during its five-game losing streak, tied for its longest of the season.

The Brewers left nine men on and went 1 for 10 with runners in scoring position on Thursday.

“Their bullpen was really tough on us manager Craig Counsell said. “Their starters bent a couple (of) innings, but we didn’t get that big inning that really kind of gave us a big lead ever.”

Nelson gave up four runs on six hits, with a walk and five strikeouts and isn’t overly concerned about his team’s rut.

“I mean, we’re still in first place,” Nelson said. “You’re not going to win every single game, you’re not going to win every single series. But there’s a lot of games left to be played and we know what we’re capable of. It doesn’t make us question our ability by any means.”

Brewers: OF Ryan Braun was held out of the lineup for a second consecutive day as the team tries to monitor his workload while he played through a strained left calf that’s bothered him all season. Braun entered as a pinch hitter in the sixth and flew out with two on and two outs. … 2B Eric Sogard (sprained left ankle) could rejoin the team during its weekend series in Philadelphia.

Brewers: RHP Matt Garza (4-4) starts for Milwaukee as it begins the next leg of a 10-game road trip on Friday against the last-place Phillies.
Pirates: Start a nine-game, 10-day western road trip in Colorado on Friday. Rookie RHP Trevor Williams (3-4) faces fellow rookie Jeff Hoffman (6-1) in the opener.

Pirates 4, Brewers 2

Milwaukee Pittsburgh
ab r h bi ab r h bi
Villar 2b 5 0 2 0 S.Marte lf 4 0 0 0
Do.Sntn rf 5 0 0 0 Hrrison 3b 4 1 1 1
Aguilar 1b 3 0 1 0 McCtchn cf 4 0 1 1
T.Shaw 3b 3 0 0 0 J.Bell 1b 4 0 1 0
H.Perez lf-cf 3 1 1 0 G.Plnco rf 4 1 1 1
Pina c 4 1 2 0 A.Frzer 2b 3 1 1 0
Bre.Phl cf 2 0 1 1 Moroff ss 2 0 0 0
Broxton ph-cf 1 0 0 0 C.Stwrt c 3 1 3 1
Thames ph-lf 1 0 1 0 Taillon p 1 0 0 0
Arcia ss 3 0 1 1 LeBlanc p 0 0 0 0
Nelson p 2 0 0 0 Hudson p 0 0 0 0
Braun ph 1 0 0 0 J.Osuna ph 1 0 0 0
Drake p 0 0 0 0 Nicasio p 0 0 0 0
Blazek p 0 0 0 0 Rivero p 0 0 0 0
Bandy ph 1 0 0 0
Totals 34 2 9 2 Totals 30 4 8 4
Milwaukee 000 200 000—2
Pittsburgh 010 120 00x—4

DP_Milwaukee 1, Pittsburgh 1. LOB_Milwaukee 9, Pittsburgh 4. 2B_Villar (11), Pina (15), Bre.Phillips (1). HR_G.Polanco (9). SB_McCutchen (9), A.Frazier (8). CS_Villar (7). S_Taillon (3).

Nelson L,8-5 5 6 4 4 1 5
Drake 1 0 0 0 0 0
Blazek 2 2 0 0 0 0
Taillon W,6-3 5 1-3 6 2 2 2 8
LeBlanc H,3 2-3 0 0 0 1 1
Hudson H,16 1 1 0 0 1 1
Nicasio H,17 1 2 0 0 0 0
Rivero S,9-9 1 0 0 0 0 0

Umpires_Home, Ryan Blakney; First, Mark Wegner; Second, Mike Muchlinski; Third, Mike Winters.

T_3:03. A_33,493 (38,362).