PHILADELPHIA — Ryan Howard homered and drove in two runs, Cole Hamels outpitched Matt Harvey and the Philadelphia Phillies beat the New York Mets 3-1 Friday night.

Hamels (2-3) gave up one run and four hits in seven innings, striking out eight.

Harvey (5-1) allowed three runs and six hits in six innings for his first career loss before June and first in seven starts against Philadelphia. The hard-throwing righty was 10-0 in 16 starts in April and May.

Philadelphia’s Freddy Galvis was 3 for 3 with a walk, raising his team-best batting average to .351.

Ken Giles tossed a perfect eighth and Jonathan Papelbon finished for his sixth save in six tries.

Hamels, who came in with the lowest run support in the NL at 1.67 runs per game, didn’t need much while rebounding from a rough start — six runs allowed in a 7-0 loss at Miami.

Howard gave the Phillies a 2-1 lead when he led off the bottom of the fourth with a drive out to left-center. Howard has hit all six of his homers in the last 15 games.

Ben Revere’s RBI single in the fifth extended the lead to 3-1. Carlos Ruiz started the inning with a single and advanced on Hamels’ sacrifice.

The Phillies took a 1-0 lead in the first on Howard’s RBI single. Galvis hit a single, stole second and scored on Howard’s hard liner.

The Mets tied it at 1 in the fourth when Hamels threw a wild pitch with the bases loaded.

Hamels improved to 9-14 in 32 starts against New York. The three-time All-Star has given up one run or fewer in three of his last four starts.

The Phillies beat the Mets for only the fifth time in the last 20 games.

The Mets wasted a chance after Dilson Herrera led off the third with a double. Harvey struck out trying to sacrifice, Curtis Granderson fouled out and Juan Lagares fanned.

Nationals 9, Braves 2: In Washington, Bryce Harper hit two more home runs, giving him five in two games, and Danny Espinosa also connected twice to power Washington past Atlanta.

Harper drove in five runs with three hits. On Wednesday, he homered his first three times up and drove in five runs.

Cardinals 8, Pirates 5: In Pittsburgh, Matt Holliday and Kolten Wong hit three-run homers and Michael Wacha remained unbeaten as St. Louis held off Pittsburgh.

American League

Blue Jays 7, Red Sox 0: In Toronto, Josh Donaldson and Chris Colabello hit solo home runs, Aaron Sanchez pitched a career-high seven innings and Toronto beat struggling Boston, the 3,000th win in Blue Jays history.

Donaldson connected off the facing of the third deck in the first inning and Colabello added an opposite field shot in the second. Both homers came off former Southeastern pitcher Wade Miley (1-4), who lost his third straight start.

Twins 9, Indians3: In Cleveland, Torii Hunter went 4-for-4, including a solo homer, and drove in four runs, leading Minnesota past Cleveland.

Tigers 5, Royals 4: In Detroit, Reliever Yohan Pino, called up earlier in the day by Kansas City, threw wildly to first base, allowing Anthony Gose to score the winning run in the ninth inning as Detroit Tigers beat the Royals.

Yankees 5, Orioles 4: In New York, Brian McCann hit an early two-run homer, Andrew Miller got his major league-leading 13th save and New York held on to beat Baltimore after taking a quick five-run lead.

Rays 8, Rangers 2: In St. Petersburg, Florida, Nathan Karns took a shutout into the eighth inning, pinch hitter Brandon Guyer had a three-run homer and Tampa Bay beat Texas.

Texas had won four in a row.