TORONTO — When they aren’t piling up double-digit run totals, the Boston Red Sox can’t seem to score much at all.

J.A. Happ got his 18th win, Melvin Upton Jr. hit a two-run homer and the Toronto Blue Jays snapped a four-game losing streak by beating Boston 3-2 on Saturday, closing within one game of the AL East leader.

Boston dropped to 5-3 on a nine-game trip. The Red Sox have scored three runs combined in the three defeats.

Happ (18-4) allowed two runs and four hits in six-plus innings to win for the first time since Aug. 17 at the New York Yankees, ending a three-start winless streak. He didn’t allow a hit until Chris Young’s one-out single to center in the fifth.

“Many, many times we’ve shown the ability to put up a quality offensive game,” Red Sox manager John Farrell said. “He shut us down today.”

Dustin Pedroia homered leading off the sixth and has a 28-game hitting streak against the Blue Jays.

“He’s tough,” Pedroia said of Happ. “His fastball gets on you, he locates real well, he’s got late movement on his offspeed stuff. It just wasn’t our day.”

The lack of offense proved costly to Red Sox left-hander Eduardo Rodriguez, who allowed three runs — two earned — and four hits in six innings. Rodriguez (2-7) is winless in nine starts but has allowed more than three earned runs just once in that stretch.

“He more than did his job against that lineup to give us an opportunity to win,” Farrell said.” Offensively, we just couldn’t get anything going.”

Toronto, whose players met behind closed doors for about an hour before the game, avoided matching its longest skid this season.

“It was a big win, no doubt,” Happ said. “We had better energy than we’ve had in a while today. From first pitch to last it seemed like our dugout was really into this one.”

Upton and Devon Travis both made costly errors in Friday’s 13-3 loss but followed with good days at the plate Saturday. Travis had three hits for the Blue Jays and is 6 for 9 in the first two games of the series. Upton hit his 20th homer, a two-run drive in the second.

“Two guys who took a lot of heat last night came through for us,” manager John Gibbons said.

Upton has 25 stolen bases and reached the 20-20 mark for the fourth time.

Jose Bautista made it 3-0 in the third with an RBI bloop single just beyond the reach of shortstop Xander Bogaerts.

Happ left after back-to-back singles by Hanley Ramirez and Aaron Hill put runners at the corners in the seventh. Joaquin Benoit gave up a sacrifice fly to Jackie Bradley Jr., then struck out pinch-hitter Travis Shaw.

Jason Grilli pitched the eighth, and Roberto Osuna finished for his 31st save in 34 chances, striking out Bradley with a man on for the final out.

WHAT A RELIEF

Boston relievers have not allowed an earned run over 14 2-3 innings in September.

TRAINER’S ROOM

Red Sox: OF Andrew Benintendi (left knee) is to try sliding in a simulated game Tuesday at Fenway Park, Farrell said. It is expected to be Benintendi’s final test before coming off the DL.

Blue Jays: Martin returned after leaving Wednesday’s game and sitting out Friday with a sore left knee. Martin leaped into the Red Sox dugout in search of a foul popup in the fifth, nearly colliding with Farrell. “I couldn’t believe he jumped, to be honest with you,” Farrell said.

UP NEXT

RHP Clay Buchholz (6-10) starts Sunday’s series finale for Boston and RHP Aaron Sanchez (13-2) for Toronto. Buchholz is 2-0 with a 2.31 ERA in his past four starts. Sanchez allowed two home runs Tuesday in a 7-6 loss at the Yankees, matching the total in his previous 10 outings.