WireGuard is silent when there is nothing to send. Most routers forget a UDP mapping after a while of silence, and then the server can no longer reach the peer behind that router until the peer sends something first.
Add one line to the peer section on the side that sits behind NAT, usually the home box or the phone:
[Peer]
PublicKey = abc123...
Endpoint = vpn.example.com:51820
AllowedIPs = 198.51.100.0/24
PersistentKeepalive = 25
Now that peer sends a small packet every 25 seconds, which keeps the router’s mapping open so traffic from the other side gets through. 25 is the value the wg man page uses in its example of a peer behind NAT.
You only need it when the other side must start connections. A laptop that only reaches out to a server does not need it, because its own traffic opens the path. A home server that a VPS must reach does.
The man page says most users will not need it, and I agree. It costs a tiny bit of traffic and battery on phones, so I’d set it only where the problem actually exists.
If the tunnel works right after connecting but the server cannot reach the peer a few minutes later, this is almost always why.
Further reading: wg(8) man page
Going deeper: Why a Tailscale device vanishes after 180 days, and how to stop it