CHICAGO (AP) Melky Cabrera drove in Geovany Soto with two outs in the 14th inning to give the Chicago White Sox an 8-7 win on Monday night over the Oakland Athletics.

Cabrera singled off Arnold Leon (0-2) to end the season's longest game for both teams. Dan Jennings (2-3) pitched two scoreless innings in relief for Chicago, which squandered a 7-3 lead in the ninth.

Jose Abreu and Trayce Thompson hit two-run homers off Sonny Gray in the third.

More from FoxSports

John Danks went seven innings and allowed three runs and three hits. In his first start since throwing a complete game Sept. 4 at Kansas City, Danks only surrendered solo homers to Jake Smolinski in the third, Brett Lawrie in the fourth and Josh Reddick in the seventh.

Oakland scored four times against David Robertson in the ninth to tie the game at 7. The Athletics loaded the bases on a Brett Lawrie double, Danny Valencia reaching on a dropped third strike and then Josh Reddick getting to first on a catcher's interference by Tyler Flowers wiping out a potential game-ending double play.

Robertson walked Coco Crisp to bring in a run, and after striking out Smolinski, allowed Sam Fuld's two-run single and then threw a passed ball to bring in Crisp to even the game and get Gray off the hook.

Thompson left the game after he dove for Lawrie's ball in the ninth and landed awkwardly on his left arm. The resulting double also ended Robertson's streak of 26 consecutive batters retired.

Chicago said Thompson suffered a sprained left elbow and was listed as day to day.

Gray was charged with a season-high seven runs while allowing eight hits, four walks and the two homers in three-plus innings in his shortest start of the year. His recent problems with the home run continued, after Gray entered Monday having allowed six in his previous six starts.

The seven earned runs matched a career-high and Gray's ERA rose from 2.28 to 2.56 for Oakland.

Leading 1-0, Gray allowed the pair of two-run homers in the bottom of the third to fall behind 4-1. Abreu put Chicago in front 2-1 with his 28th of the season, and Thompson followed with a drive into deep left-center field for his fourth and a 4-1 White Sox advantage.

Gray's issues carried into the bottom of the fourth when he was charged with three more runs and went behind 7-2. Gray walked Alexei Ramirez with the bases loaded and Abreu followed with a two-run single to end the right-hander's night.

TRAINER'S ROOM

Athletics: OF Billy Burns (right hamstring) went through full baseball activities Monday and might be available during this four-game series. ... RHP Edward Mujica (strained right hamstring) won't do anything over the next few days after leaving Sunday's game. He will be re-evaluated later this week. . RHP Chris Bassitt (right shoulder soreness) threw a bullpen session Monday.

White Sox: OF Avisail Garcia (back) returned to the starting lineup as Chicago's designated hitter after missing Sunday's game. . 1B/DH Adam LaRoche (right knee tendinitis) didn't start.

UP NEXT

Oakland RHP Aaron Brooks (1-3, 7.62) faces Chicago RHP Jeff Samardzija (9-12, 4.89) on Tuesday. Samardzija was dealt by Oakland to the White Sox over the offseason for a package of prospects led by INF Marcus Semien and Bassitt.