The Staphylococcus aureus (S. aureus) cow mastitis causes great losses to the cow industry. In order to improve the treatment effect of tilmicosin against cow mastitis, the combination of solid lipid nanoparticle (SLN) technology with in situ hydrogel technology was used to prepare the self-assembly tilmicosin nanogel (TIL-nanogel). The physicochemical characteristics, in vitro release, antibacterial activity and in vivo treatment efficacy of TIL-SLNs and TIL-nanogel were studied, respectively. The results showed the loading capacity (LC), encapsulation efficiency (EE), size, zeta potential and poly dispersion index (PDI) of TIL-nanogel were 23.33 ± 0.77%, 67.89 ± 3.01%, 431.57 ± 12.87 nm, 8.3 ± 0.06 mv and, 0.424 ± 0.032, respectively. The TIL-nanogel showed stronger sustained release in vitro than TIL-SLNs and commercial injection. The cure rate of half dosage and normal dosage of TIL-nanogel was 58.3% and 75.0%, which was higher than that of commercial injection (50.0%) at normal dosage. The results suggest that the treatment dosage of tilmicosin for cow mastitis could be reduced by TIL-nanogel. The novel TIL-nanogel will be beneficial by decreasing the usage of tilmicosin and the treatment costs of cow mastitis.