BALTIMORE — Two of the Toronto Blue Jays’ most reliable pitchers made some uncharacteristic mistakes, and the Baltimore Orioles made them pay.

Matt Wieters hit a go-ahead, two-run homer off Jason Grilli in the eighth inning to lead Baltimore to a 5-3 victory over Toronto on Tuesday night. That ended Grilli’s streak of 13 games (13 innings) without allowing a run.

“He’s been unbelievable,” Blue Jays manager John Gibbons said about Grilli. “We’re not sitting where we’re at right now without him, that’s for sure. He got a couple outs and the walk and then Wieters — everybody in their lineup can do that to you. We’ll bounce back tomorrow but, shoot, he’s been fantastic.”

The Orioles pulled within three games of the first-place Blue Jays, who had a four-game winning streak snapped. After losing the opener 5-1, the Orioles will look to gain more ground in the series finale Wednesday.

Michael Saunders drilled a two-run shot off Orioles starter Ubaldo Jimenez that tied the game 3-3 in the seventh.

In the eighth, Jonathan Schoop walked and Wieters homered off Grilli (4-2), his 12th of the season.

“You never want to walk anybody,” Grilli said. “Just made some good pitches that he laid off of. They were down and away off the plate. He did a good job of not swinging at balls.”

Brad Brach (8-2) picked up the win with 1 1/3 scoreless innings. Zach Britton got his league-leading 39th save.

Blue Jays left-hander J.A. Happ fell short of tying Boston’s Rick Porcello for the major league lead with 18 wins. Happ allowed three runs and six hits with three strikeouts over 6 1/3 innings.

“I wasn’t at my best tonight but this is an elite team, especially at home,” Happ said. “They’re tough. I think I made a couple mistakes; they made me pay. But we battled them all night. I gave us what I had tonight, which wasn’t a ton but it was enough to keep us in the ballgame.”

Manny Machado hit his 34th homer of the season and 100th of his career for Baltimore. Steve Pearce went deep for the 13th time this season.

Baltimore’s Pedro Alvarez, who got a rare start against a left-hander, managed two hits against Happ and is 6 for 12 in his career against him.

Jimenez started in place of the injured Chris Tillman and allowed three runs and nine hits with three strikeouts over 6 2/3 innings.

The Blue Jays took a 1-0 lead in the second on a two-out, RBI single by Kevin Pillar. Jimenez then retired the next eight batters before allowing another single to Pillar in the fifth.

Pearce tied the game 1-1 with a homer in the bottom half of that inning. Two batters later, Machado drove Happ’s 0-1 pitch over the wall in center field for a two-run homer that gave Baltimore the lead.

“We finally found some barrels on the balls and we’re able to drive in some runs in key situations,” Machado said. “Whenever you can take advantage of a guy like that after the year he’s having and how he has been pitching.”

OWNING THE O’S

Saunders has hit safely in 12 of his 14 games against the Orioles this season. He is batting .434 with seven doubles, six home runs and 14 RBIs over the span.

TRAINER’S ROOM

Orioles: CF Adam Jones performed drills but was held out of the lineup for the fourth consecutive game with a left hamstring strain. … Tillman (right shoulder bursitis) could potentially throw off a mound this weekend. However, the original target dates of Sept. 9 or 10 for his next start appear unlikely, manager Buck Showalter said.

UP NEXT

Blue Jays: Aaron Sanchez (12-2, 2.99 ERA) will be recalled from Class-A Dunedin to make the start. He spent the past 10 days in the minors to limit his innings. Sanchez has gone 2-0 with a 4.50 ERA in three starts against Baltimore this season.

Orioles: Yovani Gallardo (4-6, 5.59 ERA) has lost his past three decisions. In his last outing against the Yankees, he lasted just 1 1/3 innings, allowing eight runs and six hits.