1999 Cadillac Escalade

My headlights go on during the daytime but automatically shut off when it gets dark or even if I enter a tunnel. Then my dashboard lights come on but headlights stay off. Is there a sensor that may need to be replaced? And where is its location? Under the hood or in the dash somewhere? Have checked the fuses and they are intact. Please advise