We describe an improved method to estimate the Total Electron Content (TEC) of the Mars ionosphere from the echoes recorded by the Mars Advanced Radar for Subsurface and Ionosphere Sounding (MARSIS) (Picardi et al., 2005; Orosei et al., 2015) onboard Mars Express in its subsurface sounding mode. In particular, we demonstrate that this method solves the issue of the former algorithm described at (Cartacci et al., 2013), which produced an overestimation of TEC estimates on the day side.The MARSIS signal is affected by a phase distortion introduced by the Mars ionosphere that produces a variation of the signal shape and a delay in its travel time. The new TEC estimation is achieved correlating the parameters obtained through the correction of the aforementioned effects.In detail, the knowledge of the quadratic term of the phase distortion estimated by the Contrast Method (Cartacci et al., 2013), together with the linear term (i.e. the extra time delay), estimated through a radar signal simulator, allows to develop a new algorithm particularly well suited to estimate the TEC for solar zenith angles (SZA) lower than 95° The new algorithm for the dayside has been validated with independent data from MARSIS in its Active Ionospheric Sounding (AIS) operational mode, with comparisons with other previous algorithms based on MARSIS subsurface data, with modeling and with modeling ionospheric distortion TEC reconstruction.