What you're describing is a frequent problem posted to this forum and the simple solution is to soak the door latches in WD-40 and slam the doors closed for a few times.
Some past threads:
http://www.fordrangerforum.com/elect...t-problem.html
"Door ajar" and interior lite malfunction?
Dome Lights
Door Ajar Light
http://www.fordrangerforum.com/elect...r-problem.html