Detwiler (6-4) -- who allowed three hits and two walk, and struck out three -- set down the last 14 batters he faced.
Tyler Clippard isued two walks in the ninth but earned his 21st save.
LaRoche had two singles to go with the home run, a leadoff shot in the bottom of the second off Phillies' starter Cole Hamels (11-6), who gave up three runs on eight hits with one walk and nine strikeouts over seven innings.
The win allowed the NL East-leading Nationals to avoid being swept by last-place Philadelphia.
Jayson Werth, back in action after 60 days on the disabled list due to a broken wrist, drove in a run on a groundout in the third for the Nationals.