I wouldn't say "you have to be home by such and such time" but just let him know the latest you are walking your ass to the door after you get in bed is 12:30. If he wants to get in, he will make it by that time. If not, sleep in the hallway or at the friend's house.