The Hajj mass gathering attended by over two million Muslim pilgrims from around the world is a risk for heat-related illnesses (HRIs). We investigated the knowledge, attitude and practice (KAP) of pilgrims attending the 2017 Hajj regarding HRIs and their prevention. Adult pilgrims (1801) from six countries in Africa, Asia and the Middle East were interviewed using a structured questionnaire. Pilgrims had a mean age of 47.2 years (SD = 12.6) and a male:female ratio of 2.2:1. Over 83% declared having at least a secondary education. Pilgrims generally had good knowledge and above average attitude and practice according to our scoring criteria. Most pilgrims were aware of HRIs and preventive measures. However, poor hydration and reluctance to use certain preventive measures or to change Hajj activities’ schedule based on environmental temperature were noted. Age, nationality and level of education were significantly associated with a good knowledge of HRIs. Only nationality was significantly associated with good attitude, and good practice was significantly associated with gender, age and nationality. There were significant positive correlations between the KAP scores. These results can serve as baseline data to design effective general or targeted interventions to improve pilgrims’ knowledge and behavior and to reduce their risk of HRIs during Hajj.