I do little short bursts. Maybe with a closer friend, you could drag it out that long (you mean start talking randomly and not establishing an end right?) but usually you ask them about something, then follow with a little chat. If they seem uninterested, maybe check the topic? Or you could end it with an “I’m going to sleep now, ttyl”
End it when you feel like you have to end it.