As I said, I'm going by the evident abundance of spacegoing civilizations in Trek, not by what's logical in the real world.
Well, yeah, all I'm saying is that Trek doesn't need 100M contactable races in the galaxy to support its canon.
If we go by the Borg numbering scheme (and assume it's sequential), the highest number I recall is 10026.
Let's assume they mapped out their home quadrant pretty well (they knew the Kazon, just didn't consider them worth assimilating - those coral reef head keep breaking the glass in the regeneration chambers or some such), ignore the outer dimension creatures like 8742, and remember that they started on the alpha quadrant.
Assuming that the whole galaxy is similiarly weighted in species, just multiplying by 3-4 quadrants seems to bring that number in the 30-40k spacefaring species range.