e.g. throw a heavy blanket over it, or force it to close its eye somehow.
https://www.dndbeyond.com/monsters/beholder
The beholder's central eye creates an area of antimagic, as in the antimagic field spell, in a 150-foot-cone.
...and the antimagic field spell only describes it as creating an "invisible sphere", with no suggestion that it would be blocked by walls etc
However there is no language in the spell to suggest it would be exempt from the normal rules for "area of effect" spells: https://www.dndbeyond.com/sources/basic-rules/spellcasting#AreasofEffect
A spell's effect expands in straight lines from the point of origin. If no unblocked straight line extends from the point of origin to a location within the area of effect, that location isn't included in the spell's area. To block one of these imaginary lines, an obstruction must provide total cover.
If we consider the eye itself to be the "point of origin" of the spell then maybe covering up the eye would block the effect?
There is an answer here that comes to the same conclusion, that antimagic field/cone is blocked by total cover ("lead shield") https://rpg.stackexchange.com/a/116809/56593
OTOH it feels like covering up the eye is rather stretching the definition of cover.
Weirdly the rules for "total cover" seem to contradict those for "area of effect" above though: https://www.dndbeyond.com/sources/basic-rules/combat#TotalCover
A target with total cover can't be targeted directly by an attack or a spell, although some spells can reach such a target by including it in an area of effect. A target has total cover if it is completely concealed by an obstacle.
I guess maybe "some spells" means only certain spells which mention a specific exemption to being blocked by total cover.
Does the eye have to be exposed for it to work? Or does the cone project through mundane barriers?