We present the results of a lattice QCD calculation of the pseudoscalar meson decay constants f_K, f_D and f_Ds, performed with N_f=2 dynamical fermions. The simulation is carried out with the tree-level improved Symanzik gauge action and with the twisted mass fermionic action at maximal twist. With respect to our previous study (0709.4574 [hep-lat]), here we have analysed data at three values of the lattice spacing (a=0.10 fm, 0.09 fm, 0.07 fm) and performed the continuum limit, and we have included at a=0.09 fm data with a lighter quark mass (m_pi = 260 MeV) and a larger volume (L = 2.7 fm), thus having at each lattice spacing L >= 2.4 fm and m_pi*L >= 3.6. Our result for the kaon decay constant is f_K=(157.5 +- 0.8|_{stat.} +- 3.3|_{syst.}) MeV and for the ratio f_K/f_pi=1.205 +- 0.006|_{stat.} +- 0.025|_{syst.}, in good agreement with the other N_f=2 and N_f=2+1 lattice calculations. For the D and D_s meson decay constants we obtain f_D=(205 +- 7|_{stat.} +- 7|_{syst.}) MeV, in good agreement with the CLEO-c experimental measurement and with other recent N_f=2 and N_f=2+1 lattice calculations, and f_{Ds}=(248 +- 3|_{stat.} +- 8|_{syst.}) MeV that, instead, is 2.3 sigma below the CLEO-c/BABAR experimental average, confirming the present tension between lattice calculations and experimental measurements.