B.J. Upton homered for the third straight day and tied a season high with four RBIs for the Rays, who have won four in a row to improve to a season-high 10 games over .500.
Longoria came within a triple of the cycle and had his first multihomer game since 2009 - one of his homers was initially ruled a single until the call was overturned after a video replay review.
Longoria had eight hits, including three home runs, and 10 RBIs in the series while going without batting gloves for the first time since his rookie season.
"I don't know, I feel pretty good right now," he said. "It's all in the way my swing's feeling and it just so happens that it started happening without the batting gloves. So I'm just going to continue until either my hands go or I've got to change it up again."
Joyce's two-out, two-run double put the Rays ahead, 9-8. Casey Kotchman followed with a two-run single.
With all their position players used, Tampa Bay sent Saturday's starting pitcher, Wade Davis, to bat as a pinch-hitter in the ninth. He got his first career hit on a single to right field to make him the first pitcher in Rays history to get a hit as a pinch-hitter. He was later thrown out at home in a collision that shook up catcher Carlos Corporan.
Longoria then hit a three-run homer with two outs to give the Rays a four-run lead.
The Astros had taken an 8-7 lead in this wild, back-and-forth game on a solo homer by Jeff Keppinger off J.P. Howell (1-1) in the seventh.
"After the fourth inning, I felt like we had already been through nine innings," Houston manager Brad Mills said.