Heterostructures are central to the efficient manipulation of charge carriers, excitons and photons for high-performance semiconductor devices. Although these can be formed by stepwise evaporation of molecular semiconductors, they are a considerable challenge for polymers owing to re-dissolution of the underlying layers. Here we demonstrate a simple and versatile photocrosslinking methodology based on sterically hindered bis(fluorophenyl azide)s. The photocrosslinking efficiency is high and dominated by alkyl side-chain insertion reactions, which do not degrade semiconductor properties. We demonstrate two new back-infiltrated and contiguous interpenetrating donor-acceptor heterostructures for photovoltaic applications that inherently overcome internal recombination losses by ensuring path continuity to give high carrier-collection efficiency. This provides the appropriate morphology for high-efficiency polymer-based photovoltaics. We also demonstrate photopatternable polymer-based field-effect transistors and light-emitting diodes, and highly efficient separate-confinement-heterostructure light-emitting diodes. These results open the way to the general development of high-performance polymer semiconductor heterostructures that have not previously been thought possible.