The key to preventing AMS is gradual ascent. It is recommended to ascend no more than 1,000 feet per day once above 8,000 feet. Adequate hydration, a balanced diet, and ensuring proper rest are also important. In some cases, medications like acetazolamide may be prescribed to help acclimatize to high altitudes.