in my youth, i did a lot of practicing. and, everyone is different, but for me, it's all about knowing your equipment and practicing different techniques. i took my time to stimulate my head and shaft in different ways and stroking in different ways. i soon learned that when i edged, the orgasms were more intense and concomitantly the loads were more and went the distance. the intensity had a lot to do with how horny i was feeling, the last time i really, really got off, and how long i had been jacking off during a given episode. generally, not always, when things and timing was right, i could shoot a distance of 5 to 6 feet.
with a partner, it's more chancey and, more or less out of "your hands," since you often cannot control the intensity of the stimulation. my best times ever with a partner are not exactly shooting for horizontal distance since i'm on my back with legs splayed giving total access to my cock and balls, but shooting for vertical distance - like blasting two or three feet up in the air, thick wads, and landing on my hair and the headboard in back of my head. this was also visual intense (and comical in a way), but also internally intense because it seemed like my cum pipeline kinda restricted deep in my balls in an almost painful way as if i was wearing a cockring.
my advice: practice. with different technqiues. and getting to know yourself and your equipment.