OAKLAND, Calif. — This trip west is proving costlier by the day for the Yankees.

In Anaheim they lost CC Sabathia, their best pitcher of late, to the disabled list with a Grade 2 strain of the left hamstring.

On Thursday night in Oakland, two of their best and hottest hitters, Gary Sanchez and Aaron Hicks, left the game with injuries, and Joe Girardi revealed after the game that reliever Adam Warren has been battling his own issue as well.

It was an overall dispiriting evening, one that ended appropriately enough on a flared shot off the bat of Khris Davis that glanced off the glove of a charging-back Starlin Castro in center, the walk-off two-run single in the 10th giving the A’s a wild 8-7 victory in front of 21,838 at Oakland Coliseum.

The Yankees (38-28), who lost their third straight on the trip, rallied from deficits of 3-0, 4-3, 5-4 and 6-5, and finally appeared to get over the hump in the 10th against Liam Hendriks when Castro’s sacrifice fly with the bases loaded brought in Brett Gardner to make it 7-6.

But with Dellin Betances already having thrown 1 2/3 innings, closing duties fell to rookie righthander Giovanny Gallegos. He retired the first two batters before Rajai Davis singled and Chad Pinder doubled. Jed Lowrie, who already had homered, tripled and singled in the game, was intentionally walked, loading the bases for Davis, who came in with 17 homers. He sent a blooper into center that Castro couldn’t quite grab to end it.

advertisement | advertise on newsday

“I did the best I could," Castro said of the final play. "That’s the bottom line, to win the game and I lost the game. When I started to run I thought I was going to get it but it hit in the glove. Tomorrow’s another day.”

"It’s not a ball I can call him off on, he had a way better chance than I did," Gardner said. "Would have liked to have been playing a couple steps shallower, then I could have caught it standing up maybe, but just kind of nestled in the right spot. Starlin made a good effort but came up a little short."

Castro’s one-out double, his third hit of the night, in the ninth off Santiago Casilla started the ninth-inning rally. Sanchez, red hot with two hits and two walks on the night to make him 14-for-his-last-30, then pounded a 1-and-1 fastball back up the middle. The single drove in Castro to tie it at 6. Sanchez, with 17 RBIs in his last 17 games, stole second and appeared to hurt himself on the slide.

Girardi said after the game that Sanchez felt something in his abductor muscle and that he was day-to-day.

“It was after the slide into second base and when I got up and tried to move, that’s when I felt the tightness there in the groin area," Sanchez said through a translator. "I don’t think it’s too much to worry about, but we have to wait and see how I feel [Friday].”

Yankees videos

Hicks, making a push for an All-Star bid, appeared to hurt himself legging out a grounder to short to end the eighth inning. He said he felt it on the swing before leaving the batter's box.

Girardi said Hicks felt something in his Achilles and that, like Sanchez, he didn't think the injury was serious, but added that the team will know more on Friday. 

"It felt really uncomfortable," Hicks said. "I’m going to see how I feel [Friday] then go from there."

Girardi also said that Warren, who last pitched Tuesday against the Angels, has been unavailable because of an issue with a "trap" muscle.

"It’s been a tough grind here," Girardi said. "We’ve had some long games and late nights, but we have to fight through it."

advertisement | advertise on newsday

Gardner singled with one out in the 10th off Hendriks and Rob Refsnyder, who replaced Hicks in center, reached on an infield single, putting runners at the corners for Judge.

The rightfielder fell behind 0-and-2 but Hendriks pitched scared, throwing four straight balls, none close, to load the bases for Castro. The second baseman, already with three hits, punched one to right to get Gardner home.

Rookie lefthander Jordan Montgomery, 2-1 with a 1.50 ERA over his previous five starts, was not sharp, allowing four runs and seven hits over 5 1/3 innings. The 24-year-old allowed two home runs for the first time this season.

Truth was, no Yankees pitcher other than Gallegos distinguished himself Thursday night.

Chad Green allowed one run and two hits over 1 1/3 innings and Tyler Clippard allowed a run, a hit and a walk over a third of an inning, turning over a jam to Betances in the eighth that the righthander could not get out of.

advertisement | advertise on newsday

Yonder Alonso’s solo homer off Montgomery in the sixth gave the A’s a 4-3 lead and Sanchez’s RBI double in the seventh tied it.

After Pinder’s RBI single off Green gave the A’s a 5-4 lead in the bottom of the seventh, Chris Carter’s solo blast off John Axford in the eighth tied it at 5.

Clippard, whose recent struggles continued, started the eighth and he departed with two on and one out after walking rookie third-base prospect Matt Chapman, who was making his big-league debut. Betances, with a 0.45 ERA this season, came on to face pinch hitter Stephen Vogt, who walked to load the bases.

Matt Joyce, 0-for-8 with eight strikeouts in his career vs. Betances, got ahead 3-and-1 but got the run in with a 4-6 groundout. The ball was hit too slow for Castro to turn two, and the A’s took a 6-5 lead.

After Sanchez tied it in the top of the ninth, Betances loaded the bases with two outs in the bottom half, but struck out Chapman to end the inning.

A’s righthander Sonny Gray took a 3-0 lead into the sixth before the Bombers pushed three runs across to tie it.

Castro singled with one out and Sanchez walked for the second time. Didi Gregorius extended his hitting streak to 17 games with a single to right, loading the bases for Chase Headley. The third baseman fell behind 1-and-2 before slicing a 2-and-2 slider to right for a two-run single that made it 3-2. Carter then struck a full-count hanging slider to left, the RBI single tying it at 3.