I only prune them if I have to. Very little. But there are others who are so adamant that pruning is important, they'll help themselves to prune your tomatoes.
Actually, if space is the limiting factor, side shoots can be pruned leaving only the central stalk to grow up and up and up. It works, but some plants will make a split "fork", then you have 2 stems growing up.
Also about space limits, if the tomato plants are getting huge and outahand, going well beyond the cage and ya can't find a way to tie them all up you can trim them back.
There is another time to prune tomatoes. If you are perennializing them. A week or so before bringing them inside prune them back to the main stalks and mostly defoliate it. If it does not survive this it'd probably not be a good candidate for perennializing. Give it fresh potting soil heavy on Bone Meal as you pot it in the good potting soil. It should make beautiful growth at the nodes. Once it gets settled prune it back again to 1 to 2 feet with a few good stems with the lush growth. This'll need to be repeated every 6 weeks because a well grown inside tomato plant will really grow. Watch for whiteflies all winter until time to plant it outside. It may give you a couple tomatoes inside, nice, tender pretty tomatoes, but only one, maybe 2.
Everybody has different views on pruning tomatoes. Boy have I grown tomatoes. Big ones. In Montana.