The $CP$ asymmetry in the mixing of $B_s^0$ and $overline{B}{}_s^0$ mesons is measured in proton-proton collision data corresponding to an integrated luminosity of 3.0 fb$^{-1}$, recorded by the LHCb experiment at centre-of-mass energies of 7 and 8 TeV. Semileptonic $B_s^0$ and $overline{B}{}_s^0$ decays are studied in the inclusive mode $D_s^{mp} mu^{pm} u_{mu} X$ with the $D_s^{mp}$ mesons reconstructed in the $K^+ K^- pi^{mp}$ final state. Correcting the observed charge asymmetry for detection and background effects, the $CP$ asymmetry is found to be $a_{text{sl}}^s = (0.39 pm 0.26 pm 0.20) % $, where the first uncertainty is statistical and the second systematic. This is the most precise measurement of $a_{text{sl}}^s$ to date. It is consistent with the prediction from the Standard Model and will constrain new models of particle physics.