CONTOUR, Shakes erratically sometimes

1996 Ford Contour 4cy. Runs great, except once in a while driving down the highway, it seems to go out of gear and then back in. Shakes violently. Have to pull over. Never know when it will happen. Once/twice a month maybe. Always when it is warm. Never in a Michigan winter. I have done all the normal tranny maintenance. Neutral Safety switch ???
Other then that, the tranny shifts great. Very Bizarre !

Thank you.

I think I diagnosed the problem.

I installed a Transmission Range Sensor a.k.a. Neutral Safety Switch…