We present a comparison of two methods of fitting solar-like variability to increase the efficiency of detection of Earth-like planetary transits across the disk of a Sun-like star. One of them is the harmonic fitting method that coupled with the BLS detection algorithm demonstrated the best performance during the first CoRoT blind test. We apply a Monte Carlo approach by simulating a large number of light curves of duration 150 days for different values of planetary radius, orbital period, epoch of the first transit, and standard deviation of the photon shot noise. Stellar variability is assumed in all the cases to be given by the Total Solar Irradiance variations as observed close to the maximum of solar cycle 23. After fitting solar variability, transits are searched for by means of the BLS algorithm. We find that a model based on three point-like active regions is better suited than a best fit with a linear combination of 200 harmonic functions to reduce the impact of stellar microvariability provided that the standard deviation of the noise is 2-4 times larger than the central depth of the transits. On the other hand, the 200-harmonic fit is better when the standard deviation of the noise is comparable to the transit depth. Our results show the advantage of a model including a simple but physically motivated treatment of stellar microvariability for the detection of planetary transits when the standard deviation of the photon shot noise is greater than the transit depth and stellar variability is analogous to solar irradiance variations.