On my 5x9 (maybe larger than what you're talking about but still a fairly small layout) I use an insulated track section to trigger the gate when the train passes. It is connected to AUX power.
I've had this hooked up for many years and no problems with gate operation/burning out.