I have a Marantec garage door opener. I can provide the model number if necessary. It seems like 50% of the time the sensors are not operational. I can still close the door by holding down the button. It's not related to the sun because it happens night and day and it also has a sun shield. When the sensors aren't working, the lights on the eyes are completely out. If I click the button, I just hear a click on the opener.
if sunlight on the sensor isn't causing the issue, then the problem is either bad opener, bad wiring or a bad sensor.
when the sensors are not working, use a multimeter to test the voltage put out by the opener. if that's not right, then you might have a bad opener.
next i would try disconnecting all of the wires at both ends, cutting off the exposed conductor and stripping the wires fresh, then reconnecting. make sure to thoroughly clean any corroded terminals.
if neither of those are the issue, then you need to decide which is easier for you: replacing the sensors or replacing the wiring. do one of those, and if that doesn't fix it then do the other.
The solid 20 or 22 gauge wire that comes with most openers is junk - replace it with some decent stranded wire.
I spend days trying to track down intermittent problems, and ended up replacing it all - I haven't had a problem since then.
Make sure the sensors are aligned. Try bending the brackets slightly so they point directly at each other.