We do not know exactly how efficient the Matrix is as a power source, but we do know that the Machines are proud of its efficiency. Near the end of the second film, the Architect makes comments about this at are the closest we ever see any Machine (other than Smith) come to outright bragging.
We do not know exactly how much power the Matrix can get from a human, but we do know two things:
- It is not infinite. If the Machines could get infinite power from humanity, then they would not bother with the rigamarole of farming millions of humans. They could do it with only a couple thousand, only one of which would be needed to provide power at any given time (the rest would provide redundancy, replacements, and a sustainable gene pool).
- They can get more out of a human than is required to account for that human's presence in the Matrix. Otherwise, humans wouldn't be a worthwhile power source.
We don't know the specifics of the state of AI technology in the time period in which the Matrix takes place, but it's safe to assume that AI probably doesn't consume computing resources (including power) at a lower rate than our current attempts at it in the real world. And in the real world, our best AIs are quite expensive indeed.
Now, consider that humans, as a rule, crave social contact. They need to live in an environment where other people exist. If they don't, they break down: something which, in the world of the Matrix, might cause them to reject it. Needless to say, this would cause problems for the Machines.
Therefore, the Matrix must provide some kind of social contact for its inhabitants. Theoretically, the Machines might be able to simulate social contact, but that would require one AI Program per simulated person. An average human would need several hundred of these simulated people in order to feel comfortable. But if AI is expensive, then running this many Programs -perhaps 3-400 per human- is almost certainly far more taxing on power than the Machines would want to sustain. It might even require so much power that humans would no longer be viable as a power source
A more efficient approach is to use humans not just for power, but to provide each other's social contacts, at a rate of one simulated person per actual person. Then the Matrix gets the social functionality it needs "for free"; the humans themselves provide it, rather than the Machines. Since the Matrix does not have to run "social AIs", it has that much more power available for the Machines themselves.