Gallagher threw four scoreless and hitless innings with six walks and six strikeouts in his return from a stint on the 15-day disabled list with right shoulder fatigue. The winner was closer Huston Street (6-5).
Brad Ziegler, the last of five relievers, recorded his eighth save.
Ryan Sweeney and Jack Cust hit back-to-back homers in the top of the first.
Aaron Cunningham hit a fourth inning two-run single and Eric Patterson had one RBI, while Sweeney and Rob Bowen had two hits apiece in the Athletics' second straight win.
Both Detroit runs scored on Ryan Rayburn's two-out sixth inning single.
Five players had one hit for the Tigers, losers in six of their last 10 games.
The losing pitcher was starter Armando Galarraga (12-6).
The loss dropped Detroit 11 games behind the AL Central-leading Chicago White Sox.