A search for muon neutrinos originating from dark matter annihilations in the Sun is performed using the data recorded by the ANTARES neutrino telescope from 2007 to 2012. In order to obtain the best possible sensitivities to dark matter signals, an optimisation of the event selection criteria is performed taking into account the background of atmospheric muons, atmospheric neutrinos and the energy spectra of the expected neutrino signals. No significant excess over the background is observed and $90%$ C.L. upper limits on the neutrino flux, the spin--dependent and spin--independent WIMP-nucleon cross--sections are derived for WIMP masses ranging from $ rm 50$ GeV to $rm 5$ TeV for the annihilation channels $rm WIMP + WIMP to b bar b, W^+ W^-$ and $rm tau^+ tau^-$.