Self-assembly of organic molecules is a mechanism crucial for design of molecular nanodevices. We demonstrate unprecedented control over the self-assembly, which could allow switching and patterning at scales accessible by lithography techniques. We use the scanning tunneling microscope (STM) to induce a reversible 2D-gas-solid phase transition of copper phthalocyanine molecules on technologically important silicon surface functionalized by a metal monolayer. By means of ab-initio calculations we show that the charge transfer in the system results in a dipole moment carried by the molecules. The dipole moment interacts with a non-uniform electric field of the STM tip and the interaction changes the local density of molecules. To model the transition, we perform kinetic Monte Carlo simulations which reveal that the ordered molecular structures can form even without any attractive intermolecular interaction.