The NeNa and the MgAl cycles play a fundamental role in the nucleosynthesis of asymptotic giant branch stars undergoing hot bottom burning. The 23Na(p,γ) 24Mg reaction links these two cycles and a precise determination of its rate is required to correctly estimate the contribution of these stars to the chemical evolution of various isotopes of Na, Mg and Al. At temperatures of 50T110MK, narrow resonances at Ep=140 and251keV are the main contributors to the reaction rate, in addition to the direct capture that dominates in the lower part of the temperature range. We present new measurements of the strengths of these resonances at the Laboratory for Underground Nuclear Astrophysics (LUNA). We have used two complementary detection approaches: high efficiency with a 4πBGO detector for the 140 keV resonance, and high resolution with a HPGe detector for the 251keV resonance. Thanks to the reduced cosmic ray background of LUNA, we were able to determine the resonance strength of the 251 keV resonance as ωγ=482(82)μeV and observed new gamma ray transitions for the decay of the corresponding state in24Mg at Ex=11931keV. With the highly efficient BGO detector, we observed a signal for the140 keV resonance for the first time in a direct measurement, resulting in a strength of ωγ140=1.46+0.58−0.53neV (68%CL). Our measurement reduces the uncertainty of the 23Na(p,γ)24 Mg reaction rate in the temperature range from 0.05to 0.1 GK to at most +50%−35% at0.07 GK. Accordingly, our results imply a significant reduction of the uncertainties in the nucleosynthesis calculations.