I don’t know that there is a magic potion.
Sexual harassment, as @SecondHandStoke was saying, is terribly ill-defined, and whatever it is, it is done by humans. And each human is different.
Rules and regulations within the companies may have some effect, if accompanied by punishments if the rules are broken.
But the main approach is to hire people whose personalities are such that they will not harass others. The problem, of course, is that there is no foolproof way to identify these sort of people during the hiring process.
Even before that step, however, there needs to be a strict and well-defined line of what constitutes sexual harassment. Because if it means one thing to an employee and another thing to the boss, it has no meaning at all.