I have a 2005 Mazda MPV, 110,000 miles. While driving in Florida at 60 mph on the Floridas Tpke, the engine stopped, lights went on on the dashboard, I had trouble steering and I had to coast the car until I could pull off the road. I put it in park and it started right up and I went home. This has happened several times, at different speeds. My mechanic checked the car with a hand held computer but couldn’t find any memory codes for what had happened. He mentioned that I could shift it to neutral while it was moving and start it then. I would then have to put it in drive while moving???
The next time this happens, don’t shift to neutral. Just jiggle the key and see if the engine restarts on its own. It sounds like an electrical problem. While the car is moving in gear, the transmission should be turning the engine, so if you restore electrical power, it should restart without having the engage the starter.
Oh, and yes it is okay to shift to neutral and then back to drive while moving. The transmission is designed to be able to handle this, as long as you aren’t doing it several times a day, every day.