On the top of the trans, towards the rear you'll see a black box with about 8 wires going in. This is the Transmission Range Sensor. Car off, disconnect it. Start the car and shift a gear. Does the car still die?
If it doesn't, then there is either a broken wire in that group or the range sensor is damaged.
Other than that all I can think of is that the engine is moving too much and putting strain on wiring somewhere, loosing an important connection.