headlights go out at random on 2004 Chevrolet Monte Carlo

I have automatic headlights they go out at random, usually when they're on bright the dimmer switch does feel kind of spoungey in that it don't always positively click when going from dim to bright. I hit the dimmer switch and they comes back on. I think it's in the dimmer switch but wanted some other opinions first. I'm far from a mechanic

Asked by for the 2004 Chevrolet Monte Carlo
If the dimmer switch is bad they run about $600 new, so I would try a wrecking yard or Ebay