Minimum space between square taper crank and bottom bracket
You can reduce the gap between the crank and frame to essentially zero as long as the crank does not rub in the frame. However, that is not really how square taper cranksets are supposed to be run.

What's probably happened is you got a crankset that is designed for a shorter BB spindle. Of greater concern than the gap is that your drive side crank with the chainrings is pushed outboard and your chain-line has been messed up.

What you need to do is find the correct spindle length to give you the appropriate  chain-line.