The invention belongs to the technical field of using high-pressure gas or low-grade heat source to output electric energy, and discloses a hydraulic free-piston expander linear power generation device with a counterweight system, including a first solenoid valve, a second solenoid valve, an expander body, a counterweight trolley, Linear generator, hydraulic plunger cylinder, one-way valve, third solenoid valve, accumulator, oil cylinder, pilot relief valve and manual pump, A end of the first solenoid valve is the gas inlet, P of the second solenoid valve The terminal is the gas outlet, the linear generator is provided with a stator, the stator slides along the track of the linear generator and cuts the magnetic induction line generated by the linear generator, the input terminal of the check valve is connected with the P terminal of the third solenoid valve, the accumulator It is pipe-connected with the pilot relief valve at the same time, the lower side of the pilot relief valve is pipe-connected with the oil cylinder, and the manual pump is connected in parallel at both ends of the pilot relief valve; the invention solves the problem that the expander in the prior art has a limited range of working conditions The problem applies to high pressure gas or low grade heat source to output electrical energy.