Can the Beholder use Eye Ray in melee range (RAW)? I can't find any restrictions of the sort, yet I've seen posts with people saying that the Beholder will use Bite on melee targets.
Beholders can use Eye Rays in melee without any issues.
The Eye Ray feature states:
Eye Rays. The beholder shoots three of the following magical eye rays at random (reroll duplicates), choosing one to three targets it can see within 120 feet of it: [...]
If a target is in melee range, it's clearly also within 120 feet. In addition, since the Eye Rays all require saving throws instead of ranged attack rolls, there is no downside to using them in melee.
Therefore, nothing prevents a Beholder from using Eye Rays on eligible targets in melee range.
Notably, however, targets that are within the Beholder's Antimagic Cone cannot be targeted by Eye Rays. The Beholder can also only change the status (active/inactive) and the direction of the cone at the start of its turns.
Therefore, a target that is in melee range will probably intentionally position itself in a way that either prevents the Beholder from using Eye Rays on it, or that forces the Beholder to shift the cone away from him.
The Beholder (MM 26-30, VGtM 5-18, 124-136, 176) has no restrictions that disable the rays in close combat or melee range.
Using an action for its Eye Rays, the beholders shoot two to three magical eye rays, choosing one to three targets they can see within their respective range which is up to 60-120 feet (depending on Beholder variation) of them. These Eye Rays are abilities, not (ranged) attacks.
The Beholder's Eye Rays are one of their central dynamics and a DM should want to play them out. There are different versions of Beholders whose rays work slightly differently, refer to the official stat blocks, and let your DM narrate them as they see fit in their world.
The regular or true Beholder (MM 28) variant has an Antimagic Cone that disables the rays in a particular field which however is a general restriction and not a specific melee restriction.
Antimagic Cone. The beholder's central eye creates an area of antimagic, as in the anti magic field spell, in a 150-foot cone. At the start of each of its turns, the beholder decides which way the cone faces and whether the cone is active. The area works against the beholder's own eye rays.
The Death Tyrant (MM 29) and the Spectator (MM 30) variants do not have an Antimagic Cone.
The Death Tyrant's Negative Energy Cone does not disable rays.
Negative Energy Cone. The death tyrant's central eye emits an invisible, magical 150-foot cone of negative energy. At the start of each of its turns, the tyrant decides which way the cone faces and whether the cone is active.
The Death Kiss (VGtM 124) Beholder-kin notably doesn't have a Bite attack or Eye Rays.
The Gauth (VGtM 125) Beholder-kin has no Antimagic Cone or similar ability.
The Gazer (VGtM 126) Beholder variation likewise has no Antimagic Cone or similar ability.
The former Beholder that is transformed into a Mindwitness (VGtM 176) also has no Antimagic Cone or similar ability.
So while a regular Beholder may use their Bite attack because their Antimagic Cone disables their rays, the Death Tyrant, the Spectator, the Gazer, the Gauth and the Mindwitness who also have the Bite attack will not face that restriction. The Death Kiss cannot use a Bite attack. As a DM refer to the next section for inspiration on why a Beholder variant may use a Bite attack.
Know your monsters.
The Beholder has high intelligence, charisma and wisdom, but it is also paranoid. If you are the DM, the Beholders' madness and paranoia offer material for making the Beholder take suboptimal choices in combat due to their personality. Perhaps the Spectator slew its former blue-robed master with a Bite, manipulating their orders and has since convinced itself that bite-attacks are the best way to deal with summoners who wear blue robes.
A Beholder will usually not resort to Bite attacks if it has better options the VGtM gives insight into Battle Tactics (VGtM 9-10):
A beholder analyzes its opponents, makes note of armor, weapons, and tactics, and adjusts its strategy to eliminate the most dangerous threats as quickly as possible. Although a beholder's specific actions will vary with each encounter, the creature's behavior is largely governed by the tactics discussed below.
a beholder can lurk in the dark and shoot any creature it can see within the range of its darkvision.
Use Eye Rays to Best Effect (VGtM 10):
A beholder can fire multiple eye rays on its turn, and it might use all of them in succession on its most dangerous foe. Even a very tough fighter is going to have second thoughts after taking damage from a disintegration ray, an enervation ray, and a death ray. A beholder can shift its targets after its first or second rays. For example, if a beholder intends to shoot charm, slowing, and sleep rays at a ranger, and the ranger succumbs to the charm, the beholder could use its remaining rays against other targets.
So while most Beholders have the option to use Bite attacks they will rarely do so, but there are some situations such as resistance to their rays that the Beholder will analyse or when they foresaw their death in a situation that uses their rays or due to their madness - when Beholders will use their Bite attack, if they have one.