A search for high-energy neutrinos coming from the direction of the Sun has been performed using the data recorded by the ANTARES neutrino telescope during 2007 and 2008. The neutrino selection criteria have been chosen to maximize the selection of possible signals produced by the self-annihilation of weakly interacting massive particles accumulated in the centre of the Sun with respect to the atmospheric background. After data unblinding, the number of neutrinos observed towards the Sun was found to be compatible with background expectations. The 90% CL upper limits in terms of spin-dependent and spin-independent WIMP-proton cross-sections are derived and compared to predictions of two supersymmetric models, CMSSM and MSSM-7. The ANTARES limits are comparable with those obtained by other neutrino observatories and are more stringent than those obtained by direct search experiments for the spin-dependent WIMP-proton cross-section in the case of hard self-annihilation channels (W+W-, tau(+)tau(-)).