The Phillies remained 6 1/2 games behind division-leading Atlanta, which lost to Washington, with two weeks left.
Nick Pivetta (7-13), who has won only one of his last 11 starts, struck out seven in the first three innings. O'Brien's two-run homer in the fourth inning put the Marlins ahead for good at 2-1.
"(Pivetta's) stuff was electric early," Phillies manager Gabe Kapler said. "I think the only hard-hit ball that comes to mind for me was the home run to O'Brien.
"It looked like he was going to roll and he ran into a little bit of a buzzsaw there."
Miami ended a five-game losing streak. Bryan Holaday added a pair of doubles.
Urena (7-12) allowed one run and three hits through a five-inning stint for his third straight win. He left early because of cramping in his pitching hand.
Urena is 4-0 with a 2.16 ERA over his last five starts dating to Aug. 19, when he was pitching under appeal of a six-game suspension he'd incurred for hitting Atlanta rookie Ronald Acuna with a fastball. He later dropped the appeal, and hasn't lost since.
The cramping, Urena said, was caused by throwing too many curveballs with a new grip he's been using.
"I will be fine," he said later. "It's gone away. ... I threw a couple of curveballs. I kept (the hand) open then because if I squeeze it, it probably gets worse."
The Marlins scored three times in the sixth against Luis Garcia for a 6-1 lead.
With runners at the corners and no outs, O'Brien hit a long fly to right field and Odubel Herrera -- more accustomed to playing in center -- had the ball bounce out of his glove before he smacked his head against the fence. The Phillies wound up getting a forceout at second base as a run scored.
Herrera left the game in the seventh.
Marlins: Urena was pulled for precautionary reasons.
Phillies: 3B Maikel Franco missed his fourth straight start because of pain in his right shoulder. He flipped over a rail and into a camera well last Tuesday.
Before the game, Phillies GM Matt Klentak was asked if he thought several veteran acquisitions he made before and after the July 31 non-waiver trade deadline could have worked against clubhouse chemistry down the Phillies' sad stretch.
"Whatever it is that caused us to go into a team-wide slump in August is not limited to one factor," he said. "It's probably some kind of combination of a lot of things. I will not sit here and tell you the chemistry changed in such a way that that is the reason we struggled. I don't believe that," he said.
Baseball's quietest man will be the reason for many Hall of Fame speeches
Last winter's surprise selection of Harold Baines could blow the doors to Cooperstown wide open Sunday night -- and beyond.
Royals sign former All-Star Trevor Rosenthal to minor league deal
The Kansas City Royals signed former All-Star reliever Trevor Rosenthal to a $2 million minor league contract that includes an invitation to big league spring training and up to $2.25 million in bonuses if he makes the major league roster.
Yankees GM rappels building, gets fan's message on Gerrit Cole
Brian Cashman saw a message taped to a 10th-floor window while prepping for a festival in Connecticut. "Please sign Gerrit Cole," it said. The GM's response: "I'm open to do clearly whatever, as always, is important for the Yankees."
Rays' Blake Snell strongly reacts to Tommy Pham trade on Twitch
Rays pitcher Blake Snell apologized for his reaction -- captured during a livestream on Twitch -- to news that teammate Tommy Pham was traded to San Diego.
What's next for the teams that lose the Gerrit Cole sweepstakes?
One team will land the best pitcher on the planet. The rest of his suitors? They'll have to scramble.
Source: Nationals agree to deal with World Series hero Howie Kendrick
Howie Kendrick, who capped the Nationals' improbable run to their first World Series title last season with a Game 7 home run, has reached an agreement on a one-year, $6.25 million deal to return to Washington, a source told ESPN's Jeff Passan on Friday.