If you invade Egypt, Gibraltar should be a priority right after. Therefore, Spain must be Axis, by diplo or force
With both (Egypt and Gibraltar), you can "lock" Med and spare a loooooooooot of garrisons.
In fact, it's kinda difficult for Axis if they can't or don't want fully control Med. Africa should be evacuated sooner or later if it become too costly.
Keep in mind the most important thing:
Beat the bear, win the war!