I've managed to quit that now. I'm already following the intermittent fasting regime, having finished eating by 6pm. But I was getting annoyed at having to make multiple trips to the bathroom at night.
Not anymore. My fasting now includes drinking of any kind and now I only need to pee once during the night.
I do occasionally feel dehydrated when I wake up to pee, in which case just a small sip of water, maybe half a glass, is enough to see me through the night.
As mentioned by @newbee2022 above, my sleep is much improved.