Recently, the studies on the light-matter interaction have been pushed into the ultrastrong coupling regime, which motivates the exploration of applications of the counter rotating wave (CRW) interaction. Even in the ultrastrong coupling regime, however, few photons can be generated from the vacuum by switching on the CRW interaction. Here we propose a scheme to enhance the photon generation from the vacuum by a bang-bang (switching on/off) control of the CRW interaction. By developing a pruning greedy algorithm to search the optimal control sequence, we find that the maximum photon number obtained for a given time period in our scheme can be dramatically increased up to several orders than that from switching on the CRW interaction.