My garage sensor beam keeps going out of alignment
They're pretty cheap and simple devices. Maybe yours are dirty inside or the light is getting weak.
First, be sure they're well aligned and not just on the edge of the range. Use a string pulled taut past each to achieve parallel and level.
Then, look at  cleaning them. Dust, grime, and insect nests may be clogging the lenses. You may be able to pull a screw or pop tabs apart to get inside and check things out.
Finally, buy a new pair. They're not terribly expensive. Just be sure of compatibility as there are several systems and some just won't work.