The semileptonic $CP$ asymmetry in $B^0-overline{B}{}^0$ mixing, $a_{rm sl}^d$, is measured in proton-proton collision data, corresponding to an integrated luminosity of 3.0 fb$^{-1}$, recorded by the LHCb experiment. Semileptonic $B^0$ decays are reconstructed in the inclusive final states $D^-mu^+$ and $D^{*-}mu^+$, where the $D^-$ meson decays into the $K^+pi^-pi^-$ final state, and the $D^{*-}$ meson into the $overline{D}{}^0(rightarrow K^+pi^-)pi^-$ final state. The asymmetry between the numbers of $D^{(*)-}mu^+$ and $D^{(*)+}mu^-$ decays is measured as a function of the decay time of the $B^0$ mesons. The $CP$ asymmetry is measured to be $a_{rm sl}^d = (-0.02 pm 0.19 pm 0.30)%$, where the first uncertainty is statistical and the second systematic. This is the most precise measurement of $a_{rm sl}^d$ to date and is consistent with the prediction from the Standard Model.