Vehicle: 2002 Ford Ranger XLT Extended Cab 2 door pickup.
My dome light and the light on the outside of the back facing the pickup box is staying on approx. 30 to 45 minutes but does evidently go off, this happens every time I open the door. I have taken the bulbs out but would like to know what the problem could be. Is there are relay or timer and where is it located that needs to be replaced? I assume it is either in the door latch (there is no button in the door frame) or in the dome light.
The switch to turn on the dome & outside light is inside the door mounted to the latch.
Sometimes lubricateable, they are replaceable.
The dome lights have a set time limit so the battery won’t run dead. Try lubricating the switches as Ken said.
Your owners’ manual should tell you exactly how to set the lights to operate per your preference.