When you say 'truck lights up' ...do you mean the exterior lights sometimes don't come on when you Lock/Unlock it? Do you ever see a door ajar light on the dash when you are driving the vehicle (bad switch/wiring)? I would try the below easy and free things first and see if it makes a difference:
1) Inspect the battery cable connections. If ANY corrosion, clean them. Make sure the fusses and everything on them look like clean connections.
2) Grounds. Make sure the grounds to the body and engine are good.
3) Push all the fuses down, ...they have been known to work themselves up.
4) Unhook the battery cables and
leave the cables unhooked overnight. Re-hook up in the morning. That should reset the computer and associated modules. See if that makes a difference.
5) Swing by the parts store for a free
code scan and see if anything has come up that might point you to something. Also have them
test your truck's battery, in case it's starting to get low. A low battery can cause flake-outs. You might want to have the code scan done first, right away (before you do #4)... because it might indicate a bad door switch and then you have the answer. Leaving the cables unhooked will erase most of the codes.
Ultimately it could be a variety of things: Some electrical fluke (try the above things for those), bad door switch, cracked or frayed wiring in the door jamb, problem with a module or failing door switch.
But first try the easy and cheap things like listed in 1-5.
Let us know what you come up with.
