One of the main milestones in the study of opto- and electro-mechanical systems is to certify entanglement between a mechanical resonator and an optical or microwave mode of a cavity field. In this work, we show how a suitable time-periodic modulation can help to achieve large degrees of entanglement, building upon the framework introduced in Mari and Eisert (2009 Phys. Rev. Lett. 103 213603). It is demonstrated that with suitable driving, the maximum degree of entanglement can be significantly enhanced, in a way exhibiting a nontrivial dependence on the specifics of the modulation. Such time-dependent driving might help to experimentally achieve entangled mechanical systems also in situations when quantum correlations are otherwise suppressed by thermal noise.