LaRoche had three hits and two RBIs. Jayson Werth also drove in a run for the NL East leaders in his first game back from a broken wrist.
Detwiler (6-4) won for the second time in his last 11 starts. He gave up three singles and retired his final 14 batters, finishing with three strikeouts and two walks.
Sean Burnett tossed a perfect eighth and Tyler Clippard worked a hitless ninth for his 21st save in 23 chances. He walked two but struck out pinch-hitter Ryan Howard for the third out.
Howard is in a 2-for-20 slump.
Cole Hamels (11-6) allowed three runs and eight hits in seven innings. The All-Star lefty has one win in his past seven starts and has lost both outings since signing a $144 million, six-year contract last month.
Hamels won his previous two starts against Washington this season, giving up one earned run in 16 innings.
LaRoche had a second-inning home run, his 20th, to go with a run-scoring single in the third and a single in the sixth. He was thrown out by Phillies right fielder John Mayberry Jr. when he tried to score on Steve Lombardozzi's fly ball.
Philadelphia's best chance to score came in the second, but Mayberry was cut down at the plate by right fielder Bryce Harper when he tried to score on Michael Martinez's single.
LaRoche has hit in 10 straight games and is batting .432 during the stretch.
Werth, who missed nearly three months with a broken left wrist, was activated before the game and singled after LaRoche's home run. He drove in the third run in the third inning on an infield out.
NOTES: Washington RHP Jordan Zimmermann was named NL pitcher of the month for July. He joins RHP Stephen Strasburg (April) and LHP Gio Gonzalez (May) to give the Nationals the most teammates to win the monthly award since the Houston Astros had four in 1979. ... Washington placed RHP Henry Rodriguez on the disabled list with a lower back strain. ... Nationals LF Michael Morse has an 11-game hitting streak. ... The Phillies open a three-game series at Arizona on Friday. RHP Joe Blanton (8-9, 4.59 ERA) faces RHP Ian Kennedy (9-8, 4.20). ... Washington and Miami play a doubleheader on Friday. LHP John Lannan (1-0, 2.57) and Gonzalez (13-5, 3.27) will pitch for the Nationals against LHP Brad Hand (no record) and RHP Josh Johnson (6-7, 4.04). Lannan and Hand are being recalled from the minors to start the first game.