''A little bit of the swagger is back,'' Tampa Bay manager Joe Maddon said.
The Red Sox lost their fourth consecutive game.
Price (11-7) struck out 10 over eight innings. He tied the team record shared by Matt Moore and Scott Kazmir for victories in consecutive starts.
''Wonderful once again,'' Maddon said.
This was Price's first game against Boston since he hit David Ortiz with a fastball on May 30, setting off a verbal skirmish between the stars.
There was no trouble between them this time as Ortiz returned to the lineup one day after leaving a game because of back spasms.
''It's feeling better,'' Ortiz said. ''After what we did last night and today when I got up and took some medication, it felt much better.''
Ortiz had words with plate umpire Bill Miller during an early strikeout, then hit an RBI single in a two-run sixth for a 3-2 Red Sox lead.
''It definitely felt good,'' Price of striking out Ortiz. ''He's a tough out always.''
Price has pitched at least eight innings in eight of his last nine starts.
Ben Zobrist got his fourth hit, an RBI single that made it 3-all in the seventh. Later in the inning, Longoria delivered his go-ahead hit off Junichi Tazawa (1-2).
''We've won some games and we've done some things that kind of remind us of what we're capable of, but by no means are we where we want to be,'' Longoria said. ''We've got a lot of work to do.''
Tampa Bay improved to three games under .500 for the first time since May 6.
Jake McGee gave up a run in the ninth but got his 10th save.
Desmond Jennings hit a two-run homer in the fifth off Boston starter Jon Lester for a 2-1 lead.
Lester gave up two runs and six hits in six innings. He had allowed just one earned run over 31 innings in his previous four starts.
''We made David work pretty hard, but he was able to get a lot more early-out counts than I was, and that's why he was able to go a couple more innings,'' Lester said.
The crowd greeted Ortiz with sustained booing before his first at-bat in the first. The fans then gave Price a partial standing ovation after Ortiz took a called third strike.
''Our fans were pretty hot,'' Maddon said. ''They came out with a little attitude. We dug it.''
Shane Victorino connected in the second for the 20th home run allowed this season by Price. Victorino also singled home Ortiz in the sixth.
NOTES: Zobrist had infield singles in each of his first three at-bats. ... Rays OF Wil Myers (broken right wrist) hopes to take batting practice in four or five days. He could return in mid-August. ... Tampa Bay reliever Joel Peralta (illness) could come off the DL early next week. He will pitch for Single-A Charlotte on Saturday. ... Rays C Ryan Hanigan (left oblique strain) ran the bases after defensive drills. ... Boston C Ryan Lavarnway (wrist) was sent to Triple-A Pawtucket to continue his rehab assignment. ... Tampa Bay plans to recall RHP Jeremy Hellickson (elbow surgery) from Charlotte to make his second big league start of the season on Saturday night. The Red Sox will counter with RHP John Lackey.