Andrew McCutchen added three hits and knocked in two runs for the Pirates, who have won three straight games.
Volquez (5-6), who surrendered five hits and a run, exited after throwing 110 pitches, the most this season for the right-hander.
James Loney drove in the only run for the Rays (31-47), who had a chance to climb out of the cellar from baseball's worst mark, but remain behind the Arizona Diamondbacks (32-47).
Alex Cobb (2-6) yielded six hits and six runs over five innings and lost his second straight start. He gave up only one earned run combined over his previous two appearances.
Starling Marte scored on an Ike Davis groundout in the opening inning and Russell Martin plated McCutchen on what was ruled a base hit. The ball hit off Cobb, whose off-balance throw went over the head of first baseman James Loney.
The Rays cut the deficit in half in the bottom of the first when Loney's groundball single to left scored Desmond Jennings.
Pittsburgh exploded for four runs in the third. Marte led off with a double and came home on McCutchen's grounder into center field. McCutchen stole second and moved to third on a fly out. After Josh Harrison walked with two outs, Alvarez smashed his 12th homer of the year, a shot to center, for a 6-1 cushion.
Travis Snider singled in a run in the eighth and McCutchen's base hit in the ninth plated Gregory Polanco, who singled to start the frame. Polanco has reached base safely in each of his first 12 major league games since making his debut against the Cubs at PNC Park on June 10.