I saw this and wanted to chime in that I have the same problem. I have a 2002 north face, which is the same as a Z71 and my headlights will also cut in and out.
I don't have a solution, but I wanted to post all of the things I have done to troubleshoot as I hope that someone with more knowledge can get both of us set straight.
First, I am curious to know if your headlights work full time when you use the brights. For me, the brights always work and the regular beam will cut in and out. OP, do your bright lights work every time? Try it out and see if they are reliable. If they do then if one of us solves the problem we both win. Also, do you have an aftermarket radio? I ask because the light sensors are right behind the radio. I do have an aftermarket radio if it makes any difference.
I replaced the headlight switch which did not help.
I checked all of the fuses.
I checked the relay with a jumper wire.
I used a voltage meter at the connector for the headlamps to make sure it was not my bulbs and the issue existed behind the connector, it did.
I don't drive at night often, but it is very annoying and I always forget about the lights until it is too late, so I would love to get this fixed. I am considering a trip to the dealership if I can't fix this before a big cross-country drive next summer, it would be great too solve this on the cheap.
Good luck to us OP~!