You generally should not drink coffee cca 6 hours before going to sleep, there is no way diuretic effect still persist during your sleep if you adhere to this simple principle.
If you already got addicted, or just self-curing some other problems with high doses of coffee, maybe attack those problems head-first. Coffee is really not source of your issues in this case.
If we view it from perspective of addiction, then sugar should be banned in all forms first and foremost, then lets start talking about relatively mild stuff like caffeine. And all this is long after alcohol and all nicotine products are long banned. We know already how well that works, right.