The structure and size of the focusing parts will directly determine the current density and radius of the electron beam. They will also affect the quality of the electron beam. By using CST simulation software to analyze the focusing parts of electron beam guns, the effects of different structural dimension parameters on electron beam current density and beam radius are obtained. The simulation results show that when the other parameters are unchanged, the beam radius decreases from 1.44mm to 0.93mm with the distance between the upper surface of the focusing coil and the surface of electron emitting increasing from 305mm to 345mm. When the radius of the focusing coil increases from 30mm to 40mm, the beam radius increases from 0.86mm to 1.38mm. When the gap of magnetic yoke increases from 28mm to 43mm, the beam radius firstly decreases and then increases. The beam radius reaches a minimum point at 0.957mm when the gap of magnetic yoke is 34mm. We take welding test on 1mm TC4 thin-wall plate with the electron beam gun whose focusing parts has optimized by CST simulation. In the same welding process parameters, the width of weld seam by using optimized electron beam gun is lesser than that by original electron beam gun.