*Spoilers follow*
Walling off both enemy gates and biding your time while you build a decent-sized attack force is the best approach on level 4. Take out the units attacking the mushrooms (you don't have to save them all to win, but it's best to save as many as you can), then build walls with a few turrets.
Build MrChoppy as soon as you have 5 or so harvesters, then build a refinery close to each batch of mushrooms when you have enough cash - this will speed up mushroom collection. Keep repairing your walls and turrets after each attack wave. You'll generally find Li only attacks one side at a time.
Build the Power Tools upgrade, then build another spaceport and start building tanks in both. You can sell your starting refinery and science lab once you're done with them for more cash.
By the time mushrooms start to run out, you should have 10 or so tanks, which should be enough to take out the turrets by the gate. You can probably preserve some of your starting bumblebees too if you build a recharge pad to repair them. I don't think there's a big advantage to attacking from one side or the other, but don't attempt to attack both gates at once. Focus all your units on one turret at a time to take them down as quickly as possible.
Once you break through, focus on taking out the solar stations at the top of the enemy base. Taking these out will disable most turrets and a couple of the enemy spaceports, so she can't build any more units near you. At this stage, build bumblebees to mop up enemy units.
After that, it's pretty easy.
AI players have the same restrictions as you (earning power, attack power, fog of war etc), so they can't cheat.

However, they start every level with more buildings and units than you, and often more cash too, so you're always at a disadvantage at the start of a level.
On the larger levels, it is possible to force the enemy to run out of money. On the smaller ones like level 4, by that stage you'll already have overwhelmed the enemy base.