MILWAUKEE -- Offense has been hard to come by of late for the Philadelphia Phillies, who had lost 13 of their last 16 games -- averaging 2.5 runs per contest -- entering their meeting Monday against the Milwaukee Brewers at Miller Park.

So when Chase Utley belted a two-run home run in the first and Ryan Howard added another run with an RBI single in the third, the Phillies felt like they turned a corner.

While the offense stalled from there, the three runs were more than enough for left-hander Cole Hamels, who struck out seven and worked into the seventh as the Phillies halted a three-game losing streak with a 3-2 victory over Milwaukee.

"It was good just being able to go out there and see that the guys were playing good baseball from the beginning," Hamels said. "Then knowing that my job is just to go out there and go deep in the ball game and try to prevent runs, trying to keep the lead."

Hamels (3-5) held Milwaukee to two runs (one earned) on seven hits and two walks while striking out seven over 6 2/3 innings.

He might have gone one more inning had Milwaukee not made him work in the seventh. He came into the inning at 76 pitches but threw 29 more before giving way to right-hander Ken Giles.

Milwaukee left fielder Khris Davis drew a leadoff walk on five pitches, and Hamels threw six pitches to first baseman Mark Reynolds, who struck out.

Shortstop Jean Segura capped off a 10-pitch at-bat with a single to right, putting runners at first and second for pinch hitter Martin Maldonado, who struck out but drew eight more pitches from Hamels. The left-hander finished with 105 pitches on the night.

"That was 30 pitches in that inning to get two outs," Philadelphia manager Ryne Sandberg said. "He was laboring and battled and everything else. He pretty much did his job right there."

The inning was emblematic of the Brewers' own recent offensive struggles.

Milwaukee put the leadoff batter aboard in six of nine innings Monday but couldn't capitalize, going 2-for-10 with runners in scoring position and stranding six on the day.

"I thought Hamels threw the ball well," Brewers manager Ron Roenicke said. "When he got people on base, he made some really good pitches. We had a few opportunities -- not a lot -- but we had a few to get a big at-bat and we didn't get the big at-bat."

The Brewers also made three outs on the base paths, including a crucial mistake in the fifth by Segura, who was caught at third trying to advance to third on a two-run single by pinch-hitter Jeff Bianchi that made it a 3-2 game.

"Instead of looking back to see if it was caught or not, he froze on the ball so he wasn't running on the play," Roenicke said. "We had a couple that hurt us. It's part of the game. We don't like it, but it's part of the game."

Milwaukee right-hander Marco Estrada had never lost to the Phillies in 10 career appearances but found himself in trouble early Monday.

Center fielder Ben Revere led off the first inning with a base hit to center, stole second and moved to third on shortstop Andres Blanco's sacrifice bunt.

That brought up Utley, who fell behind 0-1 to Estrada before sending an 88-mph fastball to right-center for his seventh home run of the season.

It was the 27th home run of the season allowed by Estrada, who gave up at least one homer in of his last 14 starts and in 17 of 18 this season.

"I felt fine," Estrada said. "The ball Utley hit, I was trying to go up and in. Maybe I didn't get it far enough in there. I honestly didn't think he hit it that well, but he got enough of it to hit it out. That's just the way it goes."

Second baseman Utley and Revere finished with two hits for Philadelphia. Segura and right fielder Ryan Braun had two hits apiece for Milwaukee.

NOTES: Brewers RF Ryan Braun returned to the lineup Monday after missing Sunday's game with back spasms that forced him out after one inning Saturday at Cincinnati. In 15 games before getting hurt, Braun hit .317 with a home run, three triples, five doubles and 14 RBIs. ... The Phillies were swept by the Brewers earlier this season in Philadelphia. Philadelphia snapped a six-game losing streak to Milwaukee.