The invention discloses a moving beam locking device for a gantry five-axis machine, which includes a workbench, a base, a column, a second guide rail, a beam I, a beam II, a first guide rail, a chute, a slider, a hydraulic cylinder, a bracket, Locking platen, bolt hole I, support seat, connecting block, arched door post, bolt hole II, anchor connection structure, piston rod, inner groove, bolt hole III; the present invention adopts two separate beams, through which The combination of the inner groove of the inner groove and the anchor structure on the connecting block, the locking pressure plate wraps the two ends of the beam together, the hydraulic cylinder presses the piston rod on the side of the locking pressure plate, and the cooperation between the bolt and the bolt hole makes the beam and the connection The blocks constitute a whole, which avoids machining accuracy errors due to vibration during the movement of the beam. At the same time, the arched pillars inside the connection block can withstand and disperse more stress, reducing the tendency of the beam to deform.