For example using the frequency of good reviews over total reviews as score, one can do:
P1: $\frac{1000}{1000+1} = 0.999$
P2: $\frac{100}{100+10} = 0.909$
P3: $\frac{20}{20+0} = 1$
P4: $\frac{10000}{10000+500} = 0.952$
So P3 seems better followed by P1.
Using the relative frequency of good over bad, one has:
P1: $\frac{1000}{1} = 1000$
P2: $\frac{100}{10} = 10$
P3: $\frac{20}{0} = \infty$
P4: $\frac{10000}{500} = 20$
So again P3 seems better followed by P1.
P3 is indeed better even though it has less total reviews, since it has no negative review and this is very important, as the above scores indicate.
Note: In case a product has no reviews then we have an indeterminate score (like $\frac{0}{0}$) which can be assigned any base value seems most appropriate for the application (eg one can assume by default the product is good, thus 1, or assume the product is average then 0.5 and so on..)
PS: one can do many variations combining good, bad and total reviews (eg like precision and recall scores are computed using different formulas combining positive/negative/total labels).