We calculate the leptonic decay constants of B_{(s)} and D_{(s)} mesons in lattice QCD using staggered light quarks and Fermilab bottom and charm quarks. We compute the heavy-light meson correlation functions on the MILC asqtad-improved staggered gauge configurations which include the effects of three light dynamical sea quarks. We simulate with several values of the light valence- and sea-quark masses (down to ~m_s/10) and at three lattice spacings (a ~ 0.15, 0.12, and 0.09 fm) and extrapolate to the physical up and down quark masses and the continuum using expressions derived in heavy-light meson staggered chiral perturbation theory. We renormalize the heavy-light axial current using a mostly nonperturbative method such that only a small correction to unity must be computed in lattice perturbation theory and higher-order terms are expected to be small. We obtain f_{B^+} = 196.9(8.9) MeV, f_{B_s} = 242.0(9.5) MeV, f_{D^+} = 218.9(11.3) MeV, f_{D_s} = 260.1(10.8) MeV, and the SU(3) flavor-breaking ratios f_{B_s}/f_{B} = 1.229(26) and f_{D_s}/f_{D} = 1.188(25), where the numbers in parentheses are the total statistical and systematic uncertainties added in quadrature.