Halladay, the most sought-after player available on the trade market, pitched nine innings, then the Rays scored the go-ahead run against Scott Downs (1-2).
With one out, B.J. Upton reached on a fielder's choice and went to second when Carl Crawford walked. Longoria followed with a double that dropped just in front of left fielder Joe Inglett.
Matt Garza (7-7) won for the first time in four starts by allowing two runs and five hits in nine innings, his longest outing this season. He walked none and struck out nine.
J.P. Howell closed it out for his 11th save in 16 chances.
Halladay allowed two runs, one earned, and four hits. He walked three and struck out 10, the eighth 10-strikeout game of his career.
He got his first standing ovation of the night before the game was under way, with fans rising to applaud as he walked in from the bullpen.
Still, the possibility that this could be Halladay's final start in home colors did little to boost the crowd, announced at 24,151.
With trade rumors swirling, both general manager J.P. Ricciardi and interim CEO Paul Beeston declined comment when approached before the game.
"No more talk," Beeston said. "That doesn't mean I don't have a lot to say, but I'm not going to say it."
Beeston wanted to keep a lid on things after Ricciardi said Thursday that Halladay's desire to test free agency was the team's primary reason for seeking a trade. Halladay, who has a full no-trade clause, can become a free agent after the 2010 season.
After being on the receiving end of Mark Buehrle's perfect game Thursday, Crawford made sure the Rays would not go without a baserunner for the second straight day by singling up the middle in the first.
Consecutive sacrifice flies by Crawford and Longoria gave the Rays a 2-0 lead in the third but Toronto answered with a two-out rally in the bottom half. Marco Scutaro singled home Alex Rios and scored on Aaron's Hill's double to center.