Glandular organs require the development of a correctly patterned epithelial tree. These arise by iterative branching: early branches have a stereotyped anatomy, while subsequent branching is more flexible, branches spacing out to avoid entanglement. Previous studies have suggested different genetic programs are responsible for these two classes of branches. Here, working with the urinary collecting duct tree of mouse kidneys, we show that the transition from the initial, stereotyped, wide branching to narrower later branching is independent from previous branching events but depends instead on the proximity of other branch tips. A simple computer model suggests that a repelling molecule secreted by branches can in principle generate a well-spaced tree that switches automatically from wide initial branch angles to narrower subsequent ones, and that co-cultured trees would distort their normal shapes rather than colliding. We confirm this collision-avoidance experimentally using organ cultures, and identify BMP7 as the repelling molecule. We propose that self-avoidance, an intrinsically error-correcting mechanism, may be an important patterning mechanism in collecting duct branching, operating along with already-known mesenchyme-derived paracrine factors.