The Rays received three prospects from the Giants: third baseman Matt Duffy, minor league shortstop Lucius Fox and minor league pitcher Michael Santos.
Moore has a 7-7 record with a 4.08 ERA in 21 starts this year.
Moore, 27, is two seasons removed from Tommy John surgery. In April 2014, he tore a ligament in his left elbow, and missed the entire season. He returned July 2, 2015.
Moore has struck out 109 batters in 130 innings this season. He is arbitration eligible for next season despite signing a five-year deal worth $14 million with the Rays in December 2011.
Duffy, 25, is hitting .253 with four home runs and 21 RBIs this season.
Santos, 21, is 4-2 with a 2.91 ERA for Class-A club August in the South Atlantic League. Fox, 19, is hitting .207 with two home runs and 16 RBIs at Augusta.
The Giants entered Monday with a two-game lead over the second-place Los Angeles Dodgers in the National League West. The Rays are the second-worst team in the American League, ahead of only the Minnesota Twins.