Take as many as you can handle with the consideration of the following:
1) Don’t add additional AP classes just because it looks good on a transcript. What looks good is spending your time on high-impact, meaningful activities outside of one’s high school campus.
2) Don’t add AP classes if there is a high probability that you will get Bs in them. For the purposes of class rank or non-weighted GPA calculation, it is often better to determine the likelihood of getting an A before adding AP classes that may not be related to your chosen area of study. Three As and one Bs may not be as solid as simply having 3 As.
A clear formula for taking AP classes does not exist and colleges don’t necessarily rate people on the number of APs they have taken. 1-2 APs during sophomore year and 2-3 during junior and senior year may be enough, unless an extra one each year would not add significant stress or take one away from key activities. Use your discretion and speak with an expert (e.g. UCEazy) on what would work best in your individual situation.