Is there a limit to the number of times I can take the PTE test?

No, there is no such limit to the number of times you can attempt the test. The frequency or time gap with which you can take the PTE test may vary; it also depends on the policies of the exam center or the institutions that accept the results.

The organisation behind PTE (Pearson), allows the candidates to take the exam as many times as they want, until they get the desired results.

Although, other institutions or individual test centers have their own policies & restrictions or prefered time gap between attempts. It is preferable to check the test center or the institution to which the candidate is applying to for retake policies or other information.