Transient protection to prevent microcontroller freeze - Selecting MOVs and TVS diodes
As suspected you are using a single source to power MCU and input that are optoisolated. Now what's the point using opto's if it's all the same Vcc? 2nd What is a zener diode doing at hte opto input? Why isn't just simple resistor enough good? You have more possibilities:
1. Make a second secondary winding and new power source for supplying inputs (the best one)
2. Install a common mode choke, capacitors (PI filter) and TVS to power inputs
3. point 2. + remove opto's and instal RC + TVS, as the optos are useless if you use the same source.

What is going on? Your 5V wire that goes arrond your house is antenna like that picks up the noise and it transfers to MCU power supply. Extra your PSU laks the common mode choke at the input. See example: http://www.st.com/web/en/resource/technical/document/data_brief/CD00177969.pdf