MILWAUKEE -- J.J. Hardy's patience was wearing thin in extra innings, but he waited -- exactly one more pitch.
"It's just a coincidence that it's bobble day for me that it happened, but it's nice to have that many fans out there and win a ball game like that," said Hardy, who finished 3-for-5.
CC Sabathia got a no-decision instead of a victory for a change, but the Brewers still kept pace in the playoff race with their 23rd win in their last at-bat and ninth series sweep this season.
Milwaukee leads the Cardinals by 3½ games for the wild card with two games in St. Louis beginning Tuesday, and trails the Chicago Cubs by 4½ games in the NL Central after both division rivals won on Sunday as well.
Pirates reliever Jason Davis (1-4) walked Rickie Weeks with one out in the 12th. Weeks stole second moments later, setting the stage for Hardy, who drove the next pitch just over the infield for the winner.
"I was planning on swinging at that fastball, but I saw Rickie take off, so I figured I'd take it, let him get to second, scoring position," Hardy said. "Split-finger, I think he hung it a little bit and it found a hole for me."
"You just had the feeling getting out of that jam right there, we were going to win the ball game in the bottom half of the inning," Brewers manager Ned Yost said.
Gomez hit a bouncer down the left field line that went just foul before striking out.
"I thought it was right over the bag," he said.
Torres allowed a leadoff single to Rivas opening the ninth and threw a wild pitch to put him at second. Pinch hitter Nate McLouth, who'd missed the previous four games with a viral infection, singled to tie it 3-all.
Milwaukee scored two runs for Sabathia in the sixth to take the big left-hander off the hook for the loss and put him in line for a win, but the bullpen gave it right back.
Pinch hitter Freddy Sanchez tripled off reliever David Riske after Cameron, in center field, couldn't make a diving catch. Sanchez scored off Nyjer Morgan's single with one out in the seventh to tie it at 2.
Milwaukee took a 2-1 lead when Corey Hart doubled to start the sixth and scored on a single by Cameron. Pinch hitter Gabe Kapler, who came in for Sabathia, singled in the second run with two outs off Pirates starter Paul Maholm.
"The way the game was going, the flow of the game, I made my mind up that if we had a runner in scoring position, I was going to take a shot at trying to score that run for him and hold it to see if he could get the win," Yost said.
Sabathia, the AL Cy Young winner last year who had his second no-decision since coming to Milwaukee in a July 7 trade, wasn't as sharp as previous starts but held Pittsburgh scoreless until three straight singles with two outs in the fifth, capped by Doumit's RBI flare.
"Both sides left a lot of guys on base, a lot of hits, we just couldn't come up with the big one," Pirates manager John Russell said.
Sabathia finished six innings. He struck out Adam LaRoche to end the fifth, and LaRoche was ejected from the game along with Russell a half-inning later for arguing the high strike with home plate umpire Bob Davidson.
"Bob continued to agitate the situation by coming toward our dugout and yelling," Russell said. "They were exchanging words, we got Adam, pushed him down the dugout and he stopped talking and Bob kept coming. I didn't think it was handled right."
Milwaukee's postseason push gets a lot harder after a day off Monday. After two games against the Cardinals, the Brewers finish the season by playing the Mets, Phillies and Cubs 13 times in the final 26 games.
"Obviously, everyone knows they are two big games, they're right behind us in this wild-card push," Cameron said. "They've played pretty good baseball, too. Two good teams playing good baseball. Somebody's got to win and somebody's got to lose."
- Hart's double in the sixth was the first extra base hit of the game after 16 singles.
- Maholm made his 20th consecutive start of at least six innings, the longest streak in team history since Rick Rhoden accomplished it 21 times in 1986, according to the Elias Sports Bureau.
- It was the 21st straight sellout. The Brewers have sold out every game since the Sabathia trade.
- Pittsburgh last won in Milwaukee on May 3, 2007.