Gray (2-2) scattered five hits, walking one and striking out seven.
Sean Doolittle and Dan Otero combined for 1 1/3 scoreless relief innings and Grant Balfour notched his 35th save despite allowing a run in the ninth.
Coco Crisp homered and drove in both runs for the Athletics, who won for the fifth time in six contests and remained two games behind AL West-leading Texas.
Tampa Bay's Alex Cobb (8-3) absorbed a complete-game loss, yielding two runs on five hits in eight innings.
Desmond Jennings got the only RBI for the second-place Rays, who fell 4 1/2 games behind AL East-leading Boston but retained a 3 1/2-game wild card lead.
Millions of Getty images now available for free via embed tool
Boston schools pull out free condoms over wrapping complaints