PHILADELPHIA (AP) -- The Diamondbacks caught a break. They just couldn't do enough with it to slow their sinking playoff chances.
Arizona scored all three of its runs in the fourth inning when Philadelphia left fielder Domonic Brown lost a routine fly ball in the lights as twilight fell, but the Diamondbacks wouldn't score again in a 4-3 loss to the Philadelphia Phillies on Friday night.
Chase Utley walked with the bases loaded in the bottom of the ninth inning, lifting the Phillies to their fifth win in six games. Four of those victories have come in their last at-bat, including the last three.
"Anytime you have walk-off (wins), it creates excitement and right now it's carrying over to the next day," Phillies interim manager Ryne Sandberg said.
Matt Davidson had two hits and an RBI for the Diamondbacks, who have dropped four of five, damaging their fleeting playoff hopes. Coming into the day, Arizona was 9½ games behind the Dodgers in the NL West and seven back of the Reds for the second NL wild-card spot.
"They just got it done in the ninth," Arizona manager Kirk Gibson said. "We got a big break on the ball lost in the lights, but we couldn't tack on."
Cody Asche led off the ninth with a single and went to third on Jimmy Rollins' single. Heath Bell (4-2) intentionally walked Michael Young to load the bases for Kevin Frandsen. After striking out Frandsen, Bell was lifted for left-hander Eury De La Rosa.
De La Rosa ran the count to 3-2 and Utley walked when the final pitch appeared to be a bit inside.
"We were trying to work both sides of the plate," Diamondbacks catcher Tuffy Gosewisch said. "The last pitch started out, then came in and barely missed."
Darin Ruf homered for the second straight game for Philadelphia, which improved to 5-3 under Sandberg. Ruf has eight homers and 12 RBIs in 21 games this month.
Jonathan Papelbon (4-1) pitched a scoreless ninth for the win.
"We're playing together and having fun in here, being able to go out on the field believing in each other," Philadelphia left-hander Cole Hamels said. "We're taking that direction and have to keep pushing that direction as long as we possibly can."
The Phillies jumped to a 1-0 lead on Ruf's two-out homer in the second. The Diamondbacks answered with three runs in the fourth off hard-luck Hamels.
Paul Goldschmidt was credited with a double after Brown couldn't track his fly ball with the light fading and the stadium lights coming on. Martin Prado drove in Goldschmidt and Adam Eaton with a two-run double, and Davidson's RBI single put Arizona ahead 3-1.
That was it for the Diamondbacks against Hamels, who allowed six hits and walked one in seven innings.
"Hamels is always good," Gibson said. "He's smart and mixes his pitches."
The left-hander has a 1.89 ERA in his last five starts but has just one win and four no-decisions over that stretch.
Hamels, who entered with the fifth-lowest run support average among starters in the majors (3.30), remained 5-13 on the season. Still, he took solace in keeping his team in a game it won.
"Ultimately, you don't want it to come down to the last at-bat, but winning is winning," Hamels said. "I'm glad we're able to battle and stay with it. It's a good feeling to have something going the right way."
The Phillies tied it when Carlos Ruiz hit a two-run double off Wade Miley in the sixth. Miley finished the inning to complete his outing, yielding five hits and two walks.
"Unfortunately, I made some mistakes at the wrong time," Miley said. "I felt good; I just didn't make pitches when I needed it."
The Phillies threatened in the eighth against Bell, putting runners on first and second with two outs. But Bell struck out John Mayberry Jr. swinging to end the inning.
The Diamondbacks got a runner to second with two outs in the ninth off Papelbon, but Cliff Pennington flew out to center to end the threat.
NOTES: Arizona's J.J. Putz dislocated his pinky in the seventh inning trying to field Rollins' grounder to short. Putz will be placed on the DL on Saturday. . Ruiz went 2 for 4, raising his average to .600 (12 for 20) in his last six games. ... The three-game series resumes Saturday night when Phillies RHP Ethan Martin (2-2, 5.23 ERA) opposes RHP Randall Delgado (4-4, 3.82 ERA). ... The Phillies wore maroon and white pinstriped uniforms similar to what the club wore in the 1990s on '90s night. ... Frandsen snapped an 0-for-17 skid with a sixth-inning single.
Copyright 2013 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.