To improve endurance and prevent getting out of breath while swimming, focus on building your cardiovascular fitness through regular swimming practice, incorporating interval training to increase stamina, and maintaining proper breathing technique by exhaling fully underwater and inhaling quickly when turning your head to breathe. Additionally, ensure you have a balanced diet and stay hydrated to support your overall physical fitness.