Former television host Andrew O'Keefe will remain in custody, which a magistrate said is "the best thing" following his latest arrest and overdose.