The burden of influenza virus infection poses a challenge due to its significant negative impact on public health. The implementation of intervention measures including vaccination, treatment, and isolation can help alleviate this influence. In this paper, we consider an optimal control problem with both pharmacological and non-pharmacological interventions, which involves widely concerned issues such as the decline of vaccine-based immunity and the emergence of drug resistance. We prove the existence of the optimal control, solve the optimal control problem through applying the Pontryagin's maximum principle, and conduct some numerical experiments to seek out effective prevention and control strategies. We arrive at a conclusion that the best strategy to control the outbreak of influenza is to isolate infected individuals as soon as possible when medical resources are abundant, such as staying at home, avoiding crowded places and so on. Epidemiologically, we find that reducing the waning rate of vaccine-based immunity is also an effective strategy when there is energy available, and may be better than increasing treatment rates.