PHILADELPHIA — Pinch-hitter Andrew Knapp hit a game-ending homer just inside the right-field foul pole in the 13th inning as the Philadelphia Phillies came from behind to beat the Washington Nationals 4-3 Sunday.

Philadelphia has gone 5-2 against the two-time defending National League East champions over the past two weekends, increasing its edge on the Nationals to three games for second place in the division.

BRAVES 6, CARDINALS 5: Mike Foltynewicz tossed five shutout innings and Freddie Freeman homered as Atlanta held off the Cardinals to complete its first three-game sweep in St. Louis since 2012.

REDS 8, BREWERS 2: Jose Peraza kept up the parade of slams, sending Matt Harvey and the Reds over NL Central-leading Milwaukee at Cincinnati.

Peraza connected in the sixth inning for the Reds’ major league-leading ninth slam this year, tying the single-season franchise record set in 2002. It was Cincinnati’s second in two games and third in the last eight.

METS 5, MARLINS 2: Steven Matz and three relievers combined on a four-hitter, and New York escaped the NL East cellar after a one-day stay with a win at Miami.

DODGERS 6, ROCKIES 4: Matt Kemp got three hits and drove in four runs, including a go-ahead homer leading off the eighth inning that rallied host Los Angeles past Colorado to prevent a sweep.

GIANTS 9, DIAMONDBACKS 6: Brandon Belt and Joe Panik drove in two runs each and Hunter Pence delivered a pinch two-run double, leading San Francisco to a win over Arizona for a three-game sweep at Phoenix.

PIRATES 7, PADRES 5: Colin Moran hit his second grand slam of the season and Corey Dickerson and Elias Diaz also homered for the Pittsburgh, which held off the Padres to take two of three in San Diego.

AMERICAN LEAGUE

MARINERS 1, ROYALS 0: James Paxton limited Kansas City to two hits and struck out 11 in eight innings and host Seattle beat the Royals for its seventh consecutive victory.

Ben Gamel dropped a broken-bat single into shallow center to score Kyle Seager from second base in the second inning.

RAYS 3, ASTROS 2: Blake Snell struck out 10, reliever Diego Castillo fanned Jose Altuve in a key spot and Tampa Bay beat Houston to wrap up a homestand in which they went 8-1 against the Astros, Yankees and Nationals.

INDIANS 15, ATHLETICS 3: Francisco Lindor homered and hit two of Cleveland’s 11 doubles as the Indians won at Oakland to end the Athletics’ six-game winning streak.

TIGERS 9, BLUE JAYS 1: Nick Castellanos hit his fourth career grand slam, Jordan Zimmermann pitched seven strong innings and Detroit won at Toronto to snap a season-long 11-game losing streak.

ORIOLES 8, ANGELS 2: Manny Machado and Mark Trumbo hit consecutive homers after the Angels lost a popup in the sun, and the Baltimore won at home to end a seven-game losing streak.

WHITE SOX 10, RANGERS 5: Matt Davidson hit a two-run double in his second straight three-hit game to help Chicago beat the Rangers at Arlington, Texas to avoid a sweep.

INTERLEAGUE

CUBS 11, TWINS 10: Jon Lester hit a three-run homer that highlighted an eight-run burst in the second and wound up with his NL-leading 11th win as the Cubs held off Minnesota to complete a sweep in Chicago.

Ian Happ also homered for the Cubs, who have scored at least 10 runs in four straight games for the first time since 1930.