The gap you leave should be speed-dependent and about 2 seconds to allow for reaction time. Yes, this caps the highway's capacity to 0.5 cars per second per lane but roads are inherently inefficient.
This is the only good answer. No need to distract yourself by figuring out your speed and guesstimating your gap like others are saying. Just count the seconds whenever you need to
3 seconds is the guideline I've been taught here in Sweden, but yeah. Riding too close is crazy dangerous and I don't understand why people keep doing it.