Solar neutrino probes of the muon anomalous magnetic moment in the
  gauged $U(1)_{L_\mu-L_\tau}$
  Models of gauged $U(1)_{L_\mu-L_\tau}$ can provide a solution to the
long-standing discrepancy between the theoretical prediction for the muon
anomalous magnetic moment and its measured value. The extra contribution is due
to a new light vector mediator, which also helps to alleviate an existing
tension in the determination of the Hubble parameter. In this article, we
explore ways to probe this solution via the scattering of solar neutrinos with
electrons and nuclei in a range of experiments and considering high and low
solar metallicity scenarios. In particular, we reevaluate Borexino constraints
on neutrino-electron scattering, finding them to be more stringent than
previously reported, and already excluding a part of the $(g-2)_\mu$
explanation with mediator masses smaller than $2\times10^{-2}$ GeV. We then
show that future direct dark matter detectors will be able to probe most of the
remaining solution. Due to its large exposure, LUX-ZEPLIN will explore regions
with mediator masses up to $5\times10^{-2}$ GeV and DARWIN will be able to
extend the search beyond $10^{-1}$ GeV, thereby covering most of the area
compatible with $(g-2)_\mu$. For completeness, we have also computed the
constraints derived from the recent XENON1T electron recoil search and from the
CENNS-10 LAr detector, showing that none of them excludes new areas of the
parameter space. Should the excess in the muon anomalous magnetic moment be
confirmed, our work suggests that direct detection experiments could provide
crucial information with which to test the $U(1)_{L_\mu-L_\tau}$ solution,
complementary to efforts in neutrino experiments and accelerators.
