Another potential source that I found for my box after having the same symptoms that I kept losing the VNC connection:.
I was able in a problematic session to connect a LAN cable for an A/B test in the backyard and still lost connection in VNC
In the syslog file a crash has been recorded around the times when I lost connection

“612 Comm: Xorg Tainted: G C 5.10.17-v7l+ #1403
stellarmate kernel: [ 189.589306] Hardware name: BCM2711
stellarmate kernel: [ 189.589310]”

Advice from people who know how to find such things was to disable the audio driver (BMC2711). This problem might have arised with a system software update as I just use this box for Stellarmate.
Advice to solve was to open /etc/modprobe.d/raspi-blacklist.conf and add a line
blacklist snd_bcm2711

Just one clear night since to confirm it is a permanent fix yet but the audio device was not an issue in the last session.

So maybe in addition to check your Wifi connection is ok you check the syslog if you find similar entries that indicate it might not be a WiFi issue,

Alex

Read More...