Spray some WD-40 on all the door latches and then open and shut each door 10-12 times. My 2000 Ranger used to do this. I found out the door hinges were sticky and it was causing the door to not latch 100%. By spraying WD-40 on them, I unfroze them and now the door ajar lights never come on, well, unless my doors are open.
It is possible that you have a bad sensor, but try this first because it is cheap, easy, and it worked for me.