PHILADELPHIA — The music is blasting and the Phillies are having fun again. There’s plenty to celebrate these days.

Chase Utley walked with the bases loaded in the bottom of the ninth inning, lifting Philadelphia to a 4-3 comeback victory over the Arizona on Friday night.

It was the fifth win in six games for the Phillies, who have won four of those games in their last at-bat, including the last three.

“Any time 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.

The music blared in the Philadelphia clubhouse after the game — something that hasn’t been the case for most of this disappointing season.

“We’re playing together and having fun in here, being able to go out on the field believing in each other,” Phillies left-hander Cole Hamels said. “We’re taking that direction and have to keep pushing in that direction as long as we possibly can.”

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.

Matt Davidson had two hits and an RBI for the Diamondbacks, who have dropped four of five, damaging their fleeting playoff hopes. They stayed seven games behind the Reds for the second NL wild card spot.

“They just got it done in the ninth,” Arizona manager Kirk Gibson said.

Jonathan Papelbon (4-1) pitched a scoreless ninth for the win.

The Phillies jumped to a 1-0 lead on Ruf’s two-out homer in the second. The Diamondbacks scored three runs in the fourth.

Paul Goldschmidt was credited with a double after left fielder Domonic Brown lost his routine fly ball in the lights as twilight fell. Martin Prado drove in Goldschmidt and Adam Eaton with a two-run double, and Davidson’s RBI single put Arizona ahead 3-1.

“We got a big break on the ball lost in the lights, but we couldn’t tack on,” Gibson said.