The greater the temperature swing when in stretch mode, will increase the amount they stretch.
Light height is also important, I keep them close when the plants are in veg, this produces stocky plant, you have to know your light though, to know how close you can lower it!
Blue light for the win in veg!
I also transplant at sex, which can stop stretch (using transplant shock to my advantage to dwarf them.
I run 24hrs which keep temps even 24hrs which is another string to my bow in keeping them short!
Some of my dwarfed plants, dwarfed plants doesn't mean low yield!