(AP Photo/Gene J. Puskar)

Francisco Liriano struck out a season-high 12 in eight dominant innings, and the Pittsburgh Pirates beat the Philadelphia Phillies 4-1 on Thursday night.

Liriano allowed only six runners for the Pirates, who have won seven of eight to strengthen their hold on the second wild-card spot in the National League.

Ike Davis and Neil Walker broke out of slumps with RBI hits, and Pittsburgh scored three times in the sixth inning.

Liriano (5-10) got rare run support from his teammates, who had scored three runs or fewer in 13 of the left-hander's last 17 appearances. He struck out at least 12 for the fifth time in his career and won his second consecutive decision.

Mark Melancon allowed one of two runners left by Jared Hughes to score in the ninth, but earned his 29th save in 33 opportunities.

Philadelphia starter A.J. Burnett (8-16) allowed four runs and six hits in six innings.

Walker went 2-for-3 with a double, a run and an RBI, and Russell Martin singled, scored a run and drove in another for Pittsburgh, which took three of four from Philadelphia.

The Pirates got on the board when Davis, in a 2-for-18 slump, singled to score Martin in the second inning.

In the sixth, Walker - mired in a 1-for-14 rut - doubled in Travis Snider to make it 2-0. Martin added a sacrifice fly, and Gregory Polanco followed with an RBI single.

Josh Harrison, who entered with an NL-best .318 average, went 0-for-5 for Pittsburgh. He dropped to .314 and into second place behind Colorado's Justin Morneau.

The Phillies - who have lost six of seven - batted .156 (10-for-64) in their last two games against Pittsburgh. An RBI single in the ninth inning by Carlos Ruiz prevented their 14th shutout loss of the season.

Burnett, who led the NL in strikeouts last season while pitching for Pittsburgh, fanned seven Pirates.

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