We went through this with our cat who died aged 20+ (we weren't entirely sure as he was a rescue). He'd had various ailments over his last few years, epilepsy, arthritis,vestibular disease, urinary infections, diabetes... and still kept doggedly carrying on.
He saw the vet weekly in his last months and she was confident he wasn't in pain. He did become doubly incontinent though and I am sure that was distressing for him as he had always been fastidious.
He ate like a horse until the day before he died, and even put on weight at one point!
He fought so very hard to stay with us, and in the end, he passed away very gently and peacefully in his own time.
Our guy did the sleeping in the tray thing. He wee'd everywhere. Fortunately he could no longer access upstairs. It started with him weeing over the side of the tray. I tried everywhere to get him a tray suitable for a disabled cat and the only one I could find was in the US. By the time we got it, it was too late. I've since seen seed trays in garden centres that might work in terms of height to access. Not sure if access would have made a difference though.
Don't despair just yet. See what the vet advises. We thought several times we were facing into 'the decision', but he was able to keep going with meds. Our vet was amazing.
Our vet had agreed that if needed, they would come to our house to do the deed, as our cat detested going to the vet's! Unfortunately (and inevitably!!) his decline came on a Saturday morning when vet was closed for the weekend. I had sourced the contact details for a home service, but we didn't need it.
Hopefully you will manage to have some more time with your boy. Let us know how it goes tomorrow x