If you are stuck getting 4,000 resources per hit, upgrade your Barracks. You will suddenly start bringing back 6,000+.
Barbarians rely heavily on ground troops. To minimize your own losses (making the attack "better" economically), use units with high stamina and armor, or units that counter their specific makeup.
Because Barbarians have no doctor and no healing between rounds, you just need to outlast them with high defense and attack range.