Starling Marte hit a two-run homer and fell a triple short of the cycle to help the Pittsburgh Pirates beat the Philadelphia Phillies 6-4 on Monday night.

Jeff Locke (7-4) struck out nine over seven strong innings to help the Pirates keep their grip on the second NL wild card. They entered with a half-game lead ahead of Milwaukee and Atlanta.

Locke and Kyle Kendrick (8-12) were in pitcher's duel until Pittsburgh bust open a one-run lead with four runs in the eighth. The Pirates won their fourth straight and are 65-50 since May 2.

Marte has been a big reason for the hot streak. He singled, doubled and homered in his first three plate appearances and extended his hitting streak to eight games.

Mark Melancon tossed a scoreless ninth for his 27th save.

Locke, who improved to 4-0 lifetime against the Phillies, retired the first 10 batters until Jimmy Rollins hit a one-out triple in the fourth. He scored on Ryan Howard's single and 92nd RBI of the season.

Locke, though, fanned Howard twice and struck out at least one batter in every inning. His nine Ks were a season high and three more than he had combined in his last three starts (6). Locke rebounded nicely after lasting only 3-plus innings in a loss to St. Louis in his last start.

He gave up just one run and kept the Pirates in contention for their second straight playoff appearance.

The Pirates gave reason for their fans to cheer - and plenty did, with "Let's Go Pirates!" echoing through a mostly barren Citizens Bank Park with every rally.

Marte's 11th homer gave the Pirates a 2-1 lead in the fifth. The Pirates chased Kendrick in the eighth, with Neil Walker, Jordy Mercer and Brent Morel all producing run-scoring hits and Gabby Sanchez chipped in with a sacrifice fly.

Rollins was replaced by Freddy Galvis for the top of the fifth. Rollins strained his left hamstring after legging out a one-out triple in the fourth. Rollins has played in 138 of 143 games this season.

(Copyright 2014 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.)