The Rays received three prospects from the Giants: third baseman Matt Duffy, minor league shortstop Lucius Fox and minor league pitcher Michael Santos.
The Giants bolstered their bullpen by acquiring Will Smith from the Brewers.
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.
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.