As many as you need, and no more.
In all seriousness, modern DAWs let you record as many takes of the same part as you want, but there definitely is a point of diminishing returns. First, unless you are purely improvising, you should rehearse your parts so that you can play them straight through, at the tempo you want, without error. Then when recording, record as many takes as are required to get an error-free performance.
After that, however, you can get creative. Do you have ideas for alternate phrasings? Are you inspired to try different note variations? Do you have different ideas for solos, and intend to make a single composite(or “comp”) solo out of them? Then keep recording as long as you’re inspired.
But when inspiration leaves you, or when you start getting tired or making more mistakes, don’t keep recording takes just because you can. That’s a sign it’s time to move on, or, if you’re still not happy with the performance to take a break or try another day. Sometimes this means you might just record the one error-free take and move on. Other times you might record a dozen or more takes.
But remember, the possibility for endless takes doesn’t mean you should keep recording the same part endlessly.