PITTSBURGH, Pa. - The Pittsburgh Pirates got a lucky break when Boston pinch-runner Jemile Weeks was hit by a batted ball in the ninth inning, beating the Red Sox 3-2 on Thursday night to keep pace in the NL pennant race.

The Pirates won their fourth in a row. They began the day 2 1/2 games ahead of Milwaukee for the second wild-card spot, and host the Brewers in a three-game series beginning Friday night.

Down 3-2, the Red Sox put runners at the corners with no outs in the ninth against Mark Melancon. Will Middlebrooks then hit a chopper down the line and ball struck the back of Weeks' left leg as he made a dive back to third.

Weeks was called out, and Melancon retired the last two batters for his 30th save in 34 opportunities.

Gerrit Cole (10-5) allowed two runs in seven-plus innings. He won his season-best third straight start.

Starling Marte homered off Brandon Workman (1-10).