ST. PETERSBURG -- Carlos Pena played with a heavy heart on Saturday night.

Greg Montalbano, a close friend of the Rays slugger, died on Friday night, and Pena dedicated Saturday's performance to his friend's memory. That performance included two home runs, a walk and a game-winning RBI single, as the Rays took a 5-4, 10-inning win over the Rangers, with 34,281 watching at Tropicana Field.

Montalbano attended Northeastern University with Pena, and a year after Pena was drafted by the Rangers, the Red Sox drafted Montalbano in the second round.

"He was my right hand in college," Pena said. "He's been battling cancer for 10 years. Last night, he passed. The only thing that comforts me is I know he's in a better place. We're going to miss him greatly. ... I know the divinity moved in today. I just hope his family was watching, because in honor of his memory, I dedicated this game to him, because I know they're going through a tough time."

Pena hit his American League-leading 33rd and 34th home runs in his first two at-bats to give the Rays a 3-2 lead. In the bottom of the eighth, he scored from first base on a two-out double by Pat Burrell that gave the Rays a 4-3 lead. And in the 10th, Pena shot a single back through the middle off Rangers right-handed reliever Jason Grilli to score Evan Longoria from second base, giving the Rays a walk-off win.

"I was just trying to get something good to hit," Pena said. "I know that he has great breaking stuff. I also knew that he had a great fastball. So, I just tried to maintain myself as calm as I possibly could and focus on the process.

"I got a fastball to hit, and I'm glad I put the good part of the bat on the ball there and we came up with the victory in the end."

The win gave the Rays their seventh walk-off victory of the season as they moved within one game of the Rangers in the American League Wild Card race and allowed them to remain three games behind the Wild Card-leading Red Sox. But the win did not come easily and required a display of heart after the Rays took a punch to the gut in the top of the ninth.

You could almost hear the postgame act, country music's Big & Rich, tuning up their instruments as J.P. Howell took the ball in the top of the ninth. The Rays' closer quickly retired the first two hitters he faced to bring Marlon Byrd to the plate. Needing just one out to nail down what would have been a 4-3 Rays win while picking up his 16th save, Howell instead gave up a homer to Byrd, who deposited the closer's changeup into the left-field stands to tie the game.

After going quietly in the bottom of the ninth, the Rays didn't sack the bats in extra innings. Grant Balfour looked overpowering in the top of the 10th, striking out two of the three batters he faced, to bring the Rays back up to bat, paving the way for Pena's heroics.

"Everyone picked up J.P.," Rays manager Joe Maddon said. "J.P.'s done such a wonderful job this year. It's difficult for him in that moment to give up that hit with two outs. The guys absolutely picked him up tonight. I know he's going to go home feeling a lot better about it."

Given the way the game ended, Howell might have had the happiest face in the Rays' clubhouse. The left-hander's thoughts went out to Pena.

"His good buddy passed away, and he got a little emotional lift to get through this game with the game-winning knock," Howell said. "It's pretty impressive, and it makes you wonder if there's other things out there help you out."

Matt Garza started for the Rays and gave a good accounting for himself, allowing three earned runs in seven innings to pick up his fourth consecutive no-decision. He likely would have gotten the win had Michael Young not been in the Rangers' lineup on Saturday night. The Texas third baseman had a single, triple and home run in his first three at-bats to account for two of the Rangers' four runs.

"He's one of the best hitters in the game, and you just tip your hat," Garza said. "I tried to change patterns and he got me."

Rangers manager Ron Washington saluted the effort of both teams.

"Those guys played their hearts out," Washington said. "That was two teams battling and fighting to win a ballgame out there tonight."