Prominences in the solar corona are a hundredfold cooler and denser than their surroundings, with a total mass of 1013 up to 1015 g. Here, we report on the first comprehensive simulations of three-dimensional, thermally and gravitationally stratified magnetic flux ropes where in situ condensation to a prominence occurs due to radiative losses. After a gradual thermodynamic adjustment, we witness a phase where runaway cooling occurs while counter-streaming shearing flows drain off mass along helical field lines. After this drainage, a prominence-like condensation resides in concave upward field regions, and this prominence retains its overall characteristics for more than two hours. While condensing, the prominence establishes a prominence-corona transition region where magnetic field-aligned thermal conduction is operative during the runaway cooling. The prominence structure represents a force-balanced state in a helical flux rope. The simulated condensation demonstrates a right-bearing barb, as a remnant of the drainage. Synthetic images at extreme ultraviolet wavelengths follow the onset of the condensation, and confirm the appearance of horns and a three-part structure for the stable prominence state, as often seen in erupting prominences. This naturally explains recent Solar Dynamics Observatory views with the Atmospheric Imaging Assembly on prominences in coronal cavities demonstrating horns.