If Brian Matusz had won the matchup with the Tampa Bay Rays’ James Loney in the sixth inning, the rest of the Orioles’ game Sunday afternoon could have looked a lot different.

But Loney hit a double, and Orioles manager Buck Showalter decided to stay with the left-hander instead of inserting right-hander Ryan Webb and further depleting a bullpen worn thin by Friday’s doubleheader and a short outing Sunday by starter Miguel Gonzalez.

Matusz, who was brought in to face the left-handed Loney with two outs in the sixth, went on to give up another double and a two-run home run as part of a decisive seven-run inning, and the Orioles set a new season-high in runs allowed in a 12-7 loss to the Rays in front of an announced 32,665 in the series finale at Camden Yards.

Matusz and right-hander Evan Meek combined to give up nine runs and 10 hits in 3 1/3 innings Sunday, halting a stretch of 30 innings since June 21 in which Orioles relievers had allowed only one earned run.

“We ran out of bullets,” Showalter said. “You can't keep running the same [relievers] out there night after night, and our starters know that, and they take it very personal.”

The Orioles (42-39) have won just two of their last seven home series, but despite losing three out of four games over the weekend to the worst team in the American League, they remain just 1 1/2 games behind the AL East-leading Toronto Blue Jays.

But the Orioles didn’t look like contenders Sunday.

In the sixth inning, following a solo home run by No. 9 hitter Kevin Kiermaier off of Meek (0-3) to tie the game, Matt Joyce’s two-out single snapped Tampa Bay's 0-for-17 stretch with runners in scoring position and gave the Rays a 5-4 lead.

And then the floodgates opened.

Matusz allowed consecutive RBI doubles to Loney and designated hitter Brandon Guyer before surrendering a two-run homer to Logan Forsythe.

By the time Kiermaier lined to right field for the final out in the sixth, the Rays had scored seven runs in an inning for the first time this season. Tampa Bay's seven hits in the inning were also a high mark this year.

Joyce added a two-run home run in the seventh — his second of the game and career-high fifth hit of the afternoon — to make Sunday the Orioles' worst pitching performance of the year. The Rays (35-49) entered the game hitting just .231 with runners in scoring position, but they went 5-for-13 in those situations Sunday.

“That’s an aberration for our bullpen,” Orioles catcher Nick Hundley said. “They've been so solid since I’ve been over here. They’ve thrown the ball great.”

The Orioles scored their most runs since an 8-0 win over the New York Yankees on June 22, but seven runs and 13 hits Sunday weren’t enough to overcome the bullpen’s struggles.

After falling behind, 2-0, the Orioles scored their first run in the third when Steve Pearce’s single scored right fielder Nick Markakis. Then, Manny Machado’s two-run homer in the fourth inning put the Orioles ahead, 3-2. The third baseman has reached safely in the last eight games and has a home run in three of the last four.

Rays right-hander Alex Cobb (3-6) earned the win despite only pitching five innings. He gave up four runs (three earned) and eight hits while striking out three batters.

Ryan Flaherty, who came into the game as a defensive replacement in the eighth, added a three-run home run in the ninth. But the Orioles' rally ended when Caleb Joseph struck out swinging to end the game with two runners on base.

“Times like this, you'd like to come out with a ‘W’ when you score seven runs,” Showalter said.

The Orioles had several opportunities to blow the game open in their favor, but they went 2-for-10 with runners in scoring position. They put two runners on base for Nelson Cruz in the third inning, but he grounded out on the first pitch to end the threat.

That came after Markakis’ double into the left-center-field gap that nearly scored Hundley from first base, but the catcher was easily thrown out at home plate for the second out. The hit made Markakis the eighth player in Orioles history to record at least 100 hits in nine different seasons with the club.

Meanwhile, the Rays wasted no time attacking Gonzalez’s fastball. After the Orioles right-hander walked center fielder Desmond Jennings to lead off the game, Ben Zobrist laced a 90 mph pitch for a double to score the first run.

Joyce hit his first home run in the third inning, a solo shot deep into the seats in right-center field. Zobrist followed in the fifth by turning on a four-seamer to tie the game at 3. It was the 13th home run surrendered by Gonzalez this season and the fourth time that he has given up two in a game this year.

“That was a tough one to swallow,” Gonzalez said. “[The bullpen] has been doing a good job, and I just feel like I [let] them down. They grinded it out — our hitters, as well. They did what they had to win a ballgame, but we were just a little short.”

In three starts since returning from a strained right oblique, Gonzalez has allowed 34 base runners and given up 10 runs in 14 2/3 innings. He also had a balk Sunday.

Gonzalez was pulled after walking Guyer to load the bases with two outs in the fifth, and Meek got Forsythe to chase on a high cutter to strand all three runners.

But then Meek surrendered the home run to Kiermaier in the sixth before Matusz allowed Loney’s double, and the Rays offense took command of the game.

alzuniga@baltsun.com

twitter.com/the_zuniga