Transistor using HV to switch 5v

Hi,

To protect the transistor BE junction I would put the diode across the Base to Emitter with the anode at the emitter. This will provide an alternate route for the reverse current.

Is the sensor connected to some other circuitry that needs to function?

You will likely benefit from some some resistance in the base to sensor, else the transistor base will take the full shorted (almost shorted) sensor current. The sensors of this type I am familiar with do not generate very high currents but others may be different.

For a starting point I would take the lowest voltage (30V) divide by 2 and calculate a resistor that will allow 5 ma into the base. These assumptions calculates out to ~ 3k