The process e+e-→π+π-π0γ is studied at a center-of-mass energy near the D(4S) resonance using a data sample of 469 fb-1 collected with the BABAR detector at the PEP-II collider. We have performed a precise measurement of the e+e-→π+π-π0 cross section in the center-of-mass energy range from 0.62 to 3.5 GeV. In the energy regions of the ω and φ resonances, the cross section is measured with a systematic uncertainty of 1.3%. The leading-order hadronic contribution to the muon magnetic anomaly calculated using the measured e+e-→π+π-π0 cross section from threshold to 2.0 GeV is (45.86±0.14±0.58)×10-10. From the fit to the measured 3π mass spectrum we have determined the resonance parameters Γ(ω→e+e-)B(ω→π+π-π0)=(0.5698±0.0031±0.0082) keV, Γ(φ→e+e-)B(φ→π+π-π0)=(0.1841±0.0021±0.0080) keV, and B(ρ→3π)=(0.88±0.23±0.30)×10-4. The significance of the ρ→3π signal is greater than 6σ. For the J/ψ resonance we have measured the product Γ(J/ψ→e+e-)B(J/ψ→3π)=(0.1248±0.0019±0.0026) keV.