A couple notes. First off, never let your population get above 12b unless you've got many "happiness" bonuses (mining morale resources, race bonuses, tech that gives overall happiness boost, etc). The reason is that your tax only goes up by the square root of the population on a planet, but unhappiness goes up geometrically as the population gets bigger. Ten 12b planets can support a significantly higher tax level than 10 24b planets, often more than the 40% tax boost 24b yields over 12b. But more importantly, big population planets limit how high you can set your taxes to. Notice how they always have low happiness, while your new colony with 1b has a happiness in the 70-80% range? Keep your planets capped at 12b, and the happiness spread stays small, meaning you can set taxes as high as possible.
Another facet of the square root law is that the same population spread amongst more planets yields more taxes. 10 6billion planets yield approximately the same tax revenue as 6 15billion planets for the same tax rate, yet supports a higher tax rate. This is countered somewhat by the initial colony cost, the break-even point for a colony is around 1.5b with no economy bonuses.
This small, but vital detail is key to the economy in the game. You maximize your tax income by a) distributing your population evenly amongst your planets,

keeping your population per planet low (below 12b unless you've got lots of happiness bonuses), and c) having as many planets as possible.
The AI is probably doing so well because it's not building farms, thus its planets aren't overflowing with unhappy people who pay less per citizen than the smaller planets do.