Why aren’t they in separate cells, if this one only has one bunk?
Flashback to ASiB, when John cancels his date so that he can put drugged!Sherlock to bed and be there if he needs anything.
What do you want to bet John refused to leave drunk!Sherlock alone and insisted on putting him to bed—er, bunk—and being there if he needed anything. And it was too much trouble to try to separate them, so they just said “your loss” and let John sleep on the floor, sitting by Sherlock’s bedside.
I love this reading of that! And it makes perfect sense!