Material properties depend largely on the dimensionality of the crystal structures and the associated electronic structures. If the crystal-structure dimensionality can be switched reversibly in the same material, then a drastic property change may be controllable. Here, we propose a design route for a direct three-dimensional (3D) to 2D structural phase transition, demonstrating an example in (Pb1-x Sn x )Se alloy system, where Pb2+ and Sn2+ have similar ns2 pseudo-closed shell configurations, but the former stabilizes the 3D rock-salt-type structure while the latter a 2D layered structure. However, this system has no direct phase boundary between these crystal structures under thermal equilibrium. We succeeded in inducing the direct 3D-2D structural phase transition in (Pb1-x Sn x )Se alloy epitaxial films by using a nonequilibrium growth technique. Reversible giant electronic property change was attained at x ~ 0.5 originating in the abrupt band structure switch from gapless Dirac-like state to semiconducting state.