I made this electromagnet out of a microwave oven transformer by taking out the secondary coil. It very strong but it can only attract the metals if I bring it really close. How do increase the distance at which it can attract the metals?
You need to think about the path of the magnetic field. The field is not something that flows like an electric current is electrons flowing through a conductor, but it is convenient to picture it that way. The magnetic field flows in a closed path through the center of the coil, out one end and and around the outside of the coil the the other end. The field flows most easily through iron, but if there is no iron, in the path, it will flow through the air to reach the other end of the coil. It will take the path that has the minimum distance through air. The shape of the microwave oven transformer (MOT) core tends to keep the magnetic flux close to the core. If the core was a straight bar, the flux would tend to reach out further. Also the force on another piece of iron increases as the iron moves closer to closing the air gap. Here is a diagram that shows the magnetic flux in red.
If you are energizing the magnet with AC, it might be a good idea to try DC. You might consider winding a new secondary winding with larger wire and connecting the secondary to a high-current rectifier to provide low voltage DC the way MOTs are used to make welders and jump-starting power supplies. The DC supply could then supply high current to a bar-shaped electromagnet. With DC, you wouldn't need laminated transformer steel, but would need a thick bar, at least as thick as the MOT core. It might be more convenient to build it up from smaller flat bars.
You should probably study various descriptions of MOT electromagnet and other projects that you can find on the internet. Details are different among the various projects, so you might find a different way of doing things that is more suitable for the outcome that you want. Also look for material to study about electromagnets in general.