OAKLAND, Calif. -- Baltimore manager Buck Showalter had a meeting with his coaches to decide whether to start catcher Matt Wieters in Sunday's series finale.

"It was a short conversation," Showalter said. "Matt means a lot to us and we like his presence in the lineup."

Wieters hit two solo home runs and Endy Chavez had four hits to help the Orioles beat the Oakland Athletics 9-5 on Sunday and remain within a game of the New York Yankees in the AL East.

"I'm finally putting the barrel on a few balls," Wieters said. "That's something you are always working on and once the game comes around you have to let it go."

Chavez drove in two runs for the Orioles, who have won four of six in snapping a three-game road losing streak. J.J. Hardy, Mark Reynolds, Manny Machado, Chris Davis and Robert Andino also drove in runs.

The victory improved the Orioles to 82-64 on the season, giving Baltimore its first winning season since 1997 -- the last year the franchise made a postseason appearance.

"Every game right now is a must win," Wieters said. "This is a tough place to win. To be able to get one, we'll take it, move on to Seattle and try to win a couple up there."

Josh Reddick, who drove in three runs, and Stephen Drew hit two-run home runs for the Athletics, who are two games ahead of the Orioles for the first wild-card spot. Adam Rosales had two hits.

"When you win the first two games you want to get greedy and take that third game." A's manager Bob Melvin said. "We're playing it day to day but going into this series you got a chance to take two of three from a good team like that you'll take it. Especially after the first inning, scoring a couple of runs on Reddick's home run, we really thought we had a chance to win this game as well."

Brian Matusz (6-10) retired all six batters he faced, two on strikeouts, to earn the victory. Jim Johnson got the last out for his 43rd save.

A's starter Dan Straily (2-1) lasted 4 2/3 innings, giving up four runs and five hits. He walked five and struck out one.

"I made a lot of mistakes," Straily said. "I left a lot of balls up, and that's as many walks as I've ever given up in my life. I was just out of character."

Straily's effort ended the 44-game streak in which A's pitchers had walked three or fewer batters.

Randy Wolf went four innings in his first start for the Orioles following three relief appearances. He gave up two runs and six hits, walked two and struck out four in his longest outing since going seven for Milwaukee in a loss to Philadelphia on Aug. 19.

"He's a veteran pitcher and knows how to pitch," Wieters said. "No one was too concerned when they got the two runs early. He had a shutdown inning after that and gave us two more good innings."

Wolf threw 72 pitches.

"He was our best option and kept us in the game," Showalter said. "A veteran like that knows how to minimize the damage."

Reddick's 29th home run, a two-run shot into the bleachers in right field, gave the A's a 2-0 lead in the first.

Wieters' first homer, with one out in the second, cut the lead in half. His fourth-inning home run put the Orioles ahead to stay.

Hardy's RBI single in the third tied it. Reynolds walked with the bases loaded in the fifth and Chavez's two-run single followed Machado's RBI double in the seventh.

Drew's two-run homer in the eighth made it 7-4.

Andino and Davis drove in runs for the Orioles in the ninth. Reddick added an RBI for the A's in the ninth.

Game notes

Orioles' LHP Troy Patton (ankle) pitched an inning in instructional league Sunday. He's slated to pitch at least once more and could rejoin the team next weekend. ... A's OF Coco Crisp was out of the lineup with an allergic reaction in his left eye. ... O's DH Jim Thome (neck) is scheduled to play in simulated games Monday and Tuesday. ... RHP Chris Tillman (7-2, 3.39) goes for the Orioles in Seattle on Monday night. He's 3-0 with an 0.83 ERA in three starts against his former team. ... RHP A.J. Griffin (6-0, 1.94) will pitch for the A's in Detroit on Tuesday. He's the only ML pitcher since at least 1918 to allow three runs or fewer and walk two or less in each of his first 11 starts. ... Of Weiters' 21 homers, 12 have been solo shots. ... A's OF Yoenis Cespedes played CF for just the second time. ... The A's tied a season-high by using seven pitchers.

Information from The Associated Press was used in this report.