How many recommendation letters should you ask a professor to write?
Normally, you should choose the two people who know you best and can write you the strongest letters, and ask each of them to send one letter to each program to which you are applying. Each of them will write one letter and send copies of it, with minor modifications if needed, to every program, so it isn't much more work than sending one letter.

This is to your advantage (you get the strongest letters) and also minimizes the total amount of work.

If a program needs more than two letters, or you think another professor would be a more suitable writer for one particular program (for instance,  if they have connections to that institution), then you can ask for letters from them as well. But there's no need to get letters from more different people purely for the variety.