Muslim youths must shun free sexual behaviours. However, these actions are highly prevalent, especially among the Muslim youth. This study aimed to determine the effect of qanun (local regulations based on Islamic law), religiosity and religious education on the sexual activity of Muslim youth. The study used a case-control design carried out in the province of Aceh, which applies the qanun, and in the province of North Sumatra, which does not apply the qanun. Researchers interviewed 552 Muslim youths using the snowball method and disseminating online questionnaires; data were analysed through logistic regression using Jeffeys’s Amazing Statistics Program 16 (JASP) with a confidence interval (CI) of 95%. The results of this study indicated that qanun (p 0.001; Exp B = 4.628), always prayed five times every day in the last 3 months (p = 0.027; Exp B = 1.616), and looking for various information about Islamic topics (p = 0.01; Exp B = 1.747) is associated with the prevention of sexual activity of Muslim youth. Qanun affected the prevention of sexual activities among youth; these activities were 4628 times higher in areas that do not have qanun for preventing sexual activities in Muslim youth. Muslim youth looking for various information about Islamic topics also affected the prevention of sexual activity among youth – it was 1747 times higher than those who did not seek information about various Islamic topics on preventing sexual activity in Muslim youth. Muslim youth in qanun areas were proven to have a lower sexual activity. Furthermore, Muslim youth with high religiosity (those who pray diligently and look for various information about Islamic topics) were proven to be able to prevent sexual activity. Therefore, it is necessary to increase the religiosity of Muslim youth.Contribution: This article is expected to explain the impact of qanun, religiosity, religious education and the prevention of sexual activity among Muslim youth. This research is expected to be one of the solutions that can be applied to prevent sexual activity in Muslim youth, which is occurring increasingly.