A question about using optocoupler instead of FET for longer signal wires
It would be easier to protect the gate rather than adding an opto-coupler.

To protect the gate, you can add a Zener diode with a voltage lower than the Mosfet Vgs max and a 1k resistor in serie.

You can also add a small cap to dampen the noise.







simulate this circuit &ndash; Schematic created using CircuitLab



Another simple option is to replace the FET with a NPN Transistor, since the transistor is current driven, noise from the cable will have little effect.







simulate this circuit

Don't forget the flyback diode on the relay.