Chuck is right about the optical laws. No software can do anything about that, short of inventing sharp pixels where there aren't any.
But there is one thing that will at least reduce the problem. Instead of focusing the lens with the camera fixed, use a focusing rail to move the camera with fixed focus. The problem with focusing just the lens is that it changes the distance between lens optical center and subject. This changes the whole angle of view slightly. In addition, many lenses are so constructed that focal length varies with focus distance. This is strictly a flaw, but so expensive to fully correct that it's usually not done.
If you move the whole rig, on a focusing rail, none of this happens.
Even more effective is a bellows system where only the camera body is moved, and the lens stays fixed. That's pretty specialized equipment, though.

A focusing rail can also be used to eliminate parallax error in panos, so it's a very useful investment.