This is a problem I have been having for a while and I thought I had fixed it but it has recently returned.
Sometimes my raspberry pi will lose connection on a random device. Sometimes it’s tailscale, sometimes it’s wlan, sometimes it’s both. It still shows as connected in my router even when it is unreachable. When I can access it through one device while the other is down I check for errors but can’t see any. If left alone for long enough it will fix itself (today it fixed itself after 6 hours) or I can reboot if I still have access to ssh through a working device.
To fix it last time I fixed wireless localisation settings (it was set to us instead of gb) but it being fixed after that change might have been a coincidence.
My only idea for why it doesn’t always work is because of a range extender I have upstairs (where the pi is) which is connected to the network using fritz! mesh. I think it’s a bad idea since it is placed very close to the main router (almost directly above) but my dad insists on having it.
I had a similar problem, it was caused by undervoltage. Are you using the official power supply?
Maybe a dumb question but what kind of case do you have? Hopefully not metal because I had some crazy wifi behavior before I realized the case was either dampening the signal or capturing too much noise.
Need logs to be able to tell you much. Get some output from dmesg after it happens, but before a reboot. Syslogs couldn’t hurt. Maybe setting up a metrics exporter to another machine could give you a peek into what is happening with resources.
Also give some details about OS and what you’re running on it.