Provide a high enough standard of living that extremism costs an individual too much to engage in. This may sound a bit dystopian but a fat and happy populace is much easier to govern than a starving and desperate one.
Also, education - not like nationalistic bullshit education but a general education that leads people to nuture their empathy and social awareness. When people see desperate situations and no effort to address them they’re more likely to turn to extremism then if they’re aware of an effort (even if it’s ineffective) because if there’s an effort ongoing the politically active will be more likely to join the effort rather than fighting the establishment.
Lastly, a non-shitty election system that makes everyone (not just swing state voters) feel like their voice is being heard. If you don’t think you’ll be able to effect change within the system you’re more likely to turn to extremism.