San Diego Padres second baseman Alexi Amarista loses his grip on a ground ball as Los Angeles Dodgers' Trayce Thompson arrived safely at first during the first inning of a baseball game Sunday, May 22, 2016, in San Diego. (AP Photo/Gregory Bull)
San Diego Padres second baseman Alexi Amarista loses his grip on a ground ball as Los Angeles Dodgers' Trayce Thompson arrived safely at first during the first inning of a baseball game Sunday, May 22, 2016, in San Diego. (AP Photo/Gregory Bull) Credit: Gregory Bull

San Diego — Yasiel Puig hit a tiebreaking, two-run single with the bases loaded and one out in the 17th inning and the Los Angeles Dodgers beat the San Diego Padres 9-5 on Sunday to snap a four-game losing streak.

The game started in afternoon sunshine and ended at dusk, taking 5 hours, 47 minutes.

The Dodgers started the four-run rally off rookie Luis Perdomo when Howie Kendrick hit a leadoff double that bounced over the wall in right-center field. Adrian Gonzalez was intentionally walked and reliever Ross Stripling advanced them with a groundout. Joc Pederson was intentionally walked to load the bases, and then Puig singled up the middle. Pederson scored on a wild pitch and Carl Crawford hit an RBI grounder.

Tigers 9, Rays 4

Detroit — Jordan Zimmermann (7-2) left with a strained right groin after allowing two runs and five hits in 5 innings.

Miguel Cabrera and Victor Martinez homered for Detroit, which has won six of seven. Cabrera also left early. with a left knee bruise after being hit by a pitch in the seventh.

Blue Jays 3, Twins 1

Minneapolis — Jose Bautista and Josh Donaldson started the game with back-to-back home runs in a three-run first inning against Phil Hughes (1-7), who leads in the major leagues in losses.

Marcus Stroman (5-1) allowed one run and three hits in 7 innings, one start after giving up career-highs of seven runs and 13 hits in a loss to Tampa Bay. Roberto Osuna got four straight outs for his ninth save.

Mets 3, Brewers 1

New York — Noah Syndergaard (5-2) struck out 11 in seven overpowering innings, allowing an unearned run and six hits.

Michael Conforto homered in the third off Chase Anderson (2-6) as New York completed a three-game sweep.

Nationals 8, Marlins 2

Miami — Max Scherzer (5-3) struck out eight while giving up two runs and six hits in eight innings with no walks. He has 38 strikeouts in his past three starts, including a record-tying 20 against Detroit.

Justin Bour ended Scherzer’s shutout bid with a two-run homer in the seventh.

Mariners 5, Reds 4

Cincinnati — Leonys Martin got four hits, Robinson Cano drove in two runs and Seattle completed a three-game sweep that extended Cincinnati’s losing streak to seven.

Wade Miley (5-2) shook off a rocky first to allowed four runs and eight hits in six innings. He is 5-0 over his last six starts, all Seattle victories. Steve Cishek pitched a perfect ninth for his 10th save.

Phillies 5, Braves 0

Philadelphia — Jerad Eickhoff (2-6) pitched five-hit ball over seven innings for his first win since April 13, and Philadelphia avoided a three-game sweep. He had lost his previous five decisions.

White Sox 3, Royals 2

Chicago — Todd Frazier tied for the AL lead with his 13th home run, Melky Cabrera drove in two runs and Chicago avoided what would have been the first sweep against the White Sox this season.

Rangers 9, Astros 2

Houston — Cole Hamels (5-0) won his career-best 12th straight decision. He fanned a season-high 11 in eight innings, allowing two runs — one earned — and five hits as the Rangers completed a three-game sweep.

Diamondbacks 7, Cardinals 2

St. Louis — Zack Greinke (5-3) won for the fifth time in six starts, allowing one run and five hits in eight innings.

Angels 10, Orioles 2

Anaheim, Calif. — Jered Weaver (4-3) took a shutout into the seventh inning to win for the first time since April 26, and Carlos Perez homered, had three hits and drove in a career-high five runs.

Yankees 5, Athletics 4

Oakland, Calif. — Michael Pineda (2-5) allowed three runs and six hits in six innings to win for the first time since his opening start this season, Starlin Castro hit a tiebreaking, two-out single in the sixth off Jesse Hahn (1-2) and New York extended a winning streak to five for the first time since winning seven straight last June 1-9.

Giants 1, Cubs 0

San Francisco — Madison Bumgarner pitched 7 dominant innings and doubled in a run in the fifth to lift San Francisco over Chicago.

The Giants won for the 11th time in 12 games and took two of three from a Cubs team with the best record in baseball.

Bumgarner (6-2) struck out six and allowed three hits and two walks while winning his fifth straight decision. The Giants have won each of the left-hander’s last six starts.

The Giants won despite a persistent problem hitting with runners in scoring position. They were 0 for 7 in that department and have 16 hits in their last 98 at-bats with runners in scoring position.

Bumgarner’s run-scoring double to left off Kyle Hendricks (2-4) followed Gregor Blanco’s leadoff walk.

Giants closer Santiago Casilla pitched a scoreless ninth for his 12th save.