When does the parasite lose its power?
Notice that the text of the Parasite say that "...you may use this power to ally..." (emphasis mine). It does not say "... you may use this power by allying...". 

The point is that the use of the power and the actual process of allying are not one-and-the-same; using the power triggers and allows for allying when not invited.

So as long as you have three home planets (or two in a four-planet game), you may use your power. Your power gets you to ally. 

During the Alliance phase of the next encounter, you'll either have three home planets or you won't.