Updated

(SportsNetwork.com) - It's been a harrowing two months for the Oakland Athletics, and it'll get a lot worse if things don't drastically improve in the next couple of days.

Oakland finishes off its regular season on Sunday afternoon with the finale of a weekend series with the Texas Rangers at Globe Life Park, and is hoping to finally clinch a postseason berth that seemed a formality in late July.

The Athletics had baseball's best record on July 31, in fact, but have gone 15-30 in their last 45 games, while falling out of the lead in the American League West and falling into jeopardy of losing the second of two available wild card playoff positions.

Oakland will clinch the second wild card slot with a defeat of the Rangers on Sunday. If the Athletics lose Sunday and Seattle wins against the Los Angeles Angels of Anaheim, the teams will meet in a one-game playoff on Monday to determine the final playoff entrant.

The second wild card team will visit either Kansas City or Detroit in a one- game playoff on Tuesday to advance in the playoffs.

"These things are tough," manager Bob Melvin said. "It takes a while to digest these things, and you move on to whatever the next scenario is."

Sonny Gray takes the mound for Oakland against Texas while trying to reverse a drastic late-season skid of his own.

He was 12-3 with a 2.65 earned run average after beating Texas on July 26, but is 1-7 in 11 subsequent starts with a 4.31 ERA.

Still, the most recent loss was of the hard-luck variety after Gray struck out 12 and allowed one earned run in a 2-0 loss to the Angels on Tuesday.

"That's what he does," Athletics catcher Stephen Vogt said. "I don't think anybody's ever worried about Sonny. I looked up in the fifth and he had 10 punchouts. Pretty remarkable."

He's 3-2 in five starts against Texas this season.

The Rangers have won 13 of their last 15 games to wrap up a losing season.

Nick Martinez gets one final 2014 audition for a 2015 rotation slot, coming off a defeat of Gray and the Athletics and 6 2/3 scoreless innings against Houston in his last two outings.

He was winless in his first eight home starts before defeating the Astros.

"Early in the season, you could see him let the game speed up on him," Texas interim manager Tim Bogar said. "He didn't allow that to happen."

The Rangers have won 10 of 18 games with Oakland this year.

On Saturday, Robinson Chirinos hit a two-run home run to lead the Rangers in a 5-4 win over Oakland.

Jake Smolinski hit a solo home run and scored twice while Adrian Beltre and Rougned Odor each drove in a run for the Rangers.

Scott Baker pitched four-plus innings and allowed two runs on four hits with five strikeouts. Spencer Patton (1-0) pitched a scoreless seventh inning to pick up his first career win.

Josh Donaldson was 3-for-4 with a solo home run and two runs scored while Josh Reddick also had three hits with an RBI and a run scored for the Athletics.