You can prevent viral infections by practicing good hygiene, such as washing your hands regularly, avoiding close contact with sick individuals, covering your mouth and nose when coughing or sneezing, and getting vaccinated if available.