The invention relates to high pressure and temperature gas generators. Free-piston gas generator has two chambers connected to each other with channel with bypass valve. Combustion chamber with piston with smaller diameter has inlet and bypass valves and spark plug. Piston with smaller diameter is connected with rod to piston with larger diameter that is placed in cylinder lower side of which is connected to spherical chamber for collection of working gases. The upper part of the larger cylinder is connected to pressure controller. Collection chamber has pulsation valve on outlet opening that supports constant pressure in it. It is connected with channels to collection chamber and pressure controller. The invention provides obtaining high pressure and temperature gases.