Plants take in light energy through photosynthesis, which stores light energy in sugars. Plants use the energy to produce new cells. Stem growth requires the formation of new cells. The amount of light energy reaching the plant is the result of the length of day and the intensity of the light and the angle that the light hits the plant. Tomatoes grow stronger stems during long summer days in full, direct sun.
As plants make sugars during photosynthesis, water is lost from the leaves and that creates a siphon action to pull up soil nutrients via the plant's vascular system. Vascular systems also move sugars throughout the plant. Psyllid insects poke into the vascular system to suck the nutrients drawn up from the roots and the sugars moving out from the leaves. Those lost nutrients keep the plant from making enough new cells to thicken the stems.
Nitrogen is part of genetic material -- DNA. When plants grow, they must make more DNA so each new cell has genetic material. A nitrogen deficiency results in less DNA and so fewer new cells. Plants growing in soils with a nitrogen deficiency will be short, with thin stems and leaves. The stem will be stiff and will not be able to vine. Tomato leaves will also be pale.
Phosphorus is also part of DNA and, like nitrogen, it is essential for plant growth. Phosphorus is part of all proteins. Proteins make up a large part of cells and are essential in many cell processes. A phosphorus deficiency can cause fewer proteins and less functional proteins to be produced so fewer cells are made. Badly made proteins also disrupt the functioning of existing cells, which can cause them to grow thin stems or die.