When I am driving, sometimes the door locks will lock/unlock on their own and the gauges will go haywire. When I stop and turn off the key, I lose all power to everything. Also, sometimes when I turn off the key the CD player will try to change CDs over and over, even when no CD is present.
You may want to start by checking the cable connections to the battery and the connection of the negative cable to the chassis to be certain that there isn’t a build-up of corrosion. If this doesn’t cure the problem, the next step I would take is to have the battery and charging system tested.