Wei-Yin Chen surrendered home runs in back-to-back innings in the Orioles’ 4-3 loss to the Oakland Athletics at Camden Yards on Friday, but his night was hardly a disappointment.

Despite solo blasts by Josh Donaldson and Derek Norris in the first and second innings, respectively, the Orioles left-hander put himself in position to earn the win by shutting down one of baseball’s most prolific offenses.

He scattered five hits, struck out four and walked two before handing the ball to right-hander Darren O’Day with one out in the seventh inning.

“At the start of the game, I wasn’t really getting a good feel on all of my pitches, and I couldn’t think about my game plan,” Chen said. “But after those two home runs, I settled down there and thought about how to go after the hitters.”

O’Day couldn’t hold a 3-2 lead in the eighth inning, allowing a game-tying double to deny what could have been Chen’s seventh win of the season.

Now in his third season with the Orioles, Chen has rebounded nicely from being knocked around for five runs apiece in consecutive outings in late May. He has allowed just three runs combined in his last two appearances.

“Wei-Yin gave us a great chance to win,” said Orioles manager Buck Showalter. “He settled in and started pitching in a little bit more.”

The two home runs were unusual for Chen, who entered Friday’s game having conceded just seven in 63 1/3 innings this year. Showalter thought that the lefty had some early trouble keeping pitches down, and Donaldson capitalized in the first inning by punishing Chen for leaving a fastball up in the zone for his solo shot.

But after a Craig Gentry single in the third inning, Chen retired 10 straight batters and didn’t allow a baserunner until he hit Donaldson with two outs in the sixth. The lefty followed by inducing a flyout to avoid a real scoring threat and was pulled to an ovation in the seventh inning with 102 pitches.

“I was content by my performance overall, because I was able to get through more innings with fewer pitches, but sadly we couldn’t win the ballgame,” Chen said.