Chicago was without ace Carlos Zambrano, who was scratched to give him some time to rest his tired arm.
The Phillies remained a game behind the NL East-leading Mets, who won 6-2 against the Florida Marlins. The Cubs' NL Central lead was trimmed to 4½ games over Milwaukee, which blanked Pittsburgh 7-0 on Sunday.
Moyer (12-7), who started his career with the Cubs in 1986, gave up eight hits and two runs in 5 1-3 innings, and the Phillies bullpen worked its way out of a couple of jams.
Moyer left after Kosuke Fukudome singled and Ronny Cedeno walked in the sixth. Chad Durbin entered and struck out pinch-hitter Ryan Theriot before Alfonso Soriano popped out to end the inning.
In Chicago's eighth, pinch-hitter Henry Blanco delivered a two-out RBI single against J.C. Romero to make it 5-3 and another pinch-hitter, Daryle Ward, greeted Ryan Madson with another single. But Madson struck out Soriano with two on to end the threat.
Brad Lidge then worked a perfect ninth for his 33rd save in as many chances.
Sean Marshall (3-4), subbing for Zambrano, allowed three of his five runs in the first inning. He walked two and surrendered nine hits in 5 1-3 innings.
Marshall walked Chase Utley in the first and the Phillies came through with three straight two-out hits - singles by Ryan Howard and Shane Victorino and the two-run double by Werth.
Making just his fifth start of the season and first in two weeks, Marshall gave up Werth's long homer with two outs in the fifth that made it 4-2. After a leadoff double by Carlos Ruiz and a sacrifice by Moyer in the sixth, Jeff Samardzija relieved and Jimmy Rollins greeted him with a sacrifice fly.
A bright sun helped the Cubs score twice in the third.
After Mark DeRosa and Geovany Soto opened with singles, a fielder's choice grounder left runners at first and third. Cedeno hit a high fly to center that Victorino lost in the sun at the last minute as the ball dropped for an RBI single. With the Phillies playing for a bunt, Marshall grounded an RBI single to center, trimming the lead to 3-2.
Notes: The oldest player in the majors, Moyer has given up three runs or less in 15 straight starts. He is now 3-0 in his career against the Cubs, who drafted him in the sixth round in 1984. He was 28-34 pitching for the Cubs from 1986-88. ... When rosters expand Monday, the Cubs will activate veteran RHP Jon Lieber (foot) from the disabled list and are expected to call up three or four players from Triple A. ... The Cubs finished August 20-8, their most wins in any month since going 20-10 in August 1984.