I faced the same issue of the random reset of my ESP12-E driving a onboard 5V relay 16A (RZ03-1A4-D005)
I reed many forum talking about poor power supply and how to solve it. i agree with them , this is the first point to be sure in the circuit but it's not the only problem,ESP has poor immunity to radiated emission.
This is what i did up to now:
I did a simple sketch that turns on and off continuously the onborad relay every 100mS and counting the second.(i got the elapsed seconds via serial port)
the best empirical solution was adding 15pf 0603 soldered between shield and reset pin and 47pf 0603 soldered between shield and +3V3 PIN directly on the module.
(my experience tells to me that 100nF capacitor are useless in case of High frequency due to parasitics inductance of nf cap multilayers technology)
moreover, i put all the unused pin to OUTPUT and HIGH state.
The above solution is still not perfect ,anyway the ESP works for 300 Second without reset.
I will update you soon