How does a planet lose mass to its host star?
In the case of WASP-12b, at least, the close proximity to the star has actually deformed the planet so much that it is overflowing its Roche-lobe, the area around a planet or star that . We can show this mathematically by finding the approximate Roche-lobe of the planet using:

$\frac{r_1}{A}=.46224\sqrt[3]{\frac{M_1}{M_1+M_2}}$  for $\frac{M_1}{M_2}&lt;.8$ (which it is)
where $A$ is the orbital separation and $r_1$ is the radius of the Roche-lobe around $M_1$.
Solving for $r_1$ we get $97788\pm 2318$ miles. The planet's radius is $77759 \pm 3909$ miles. Taking the best possible scenario, there would be $\approx$ 13,000 miles between the planet's surface and its Roche-lobe if the planet was a perfect sphere. It is unknown how much the star affects the planet, but it would not be a stretch to think that the major axis of the planet would be 13,000 miles longer than the minor axis, allowing for the planet's gas to be shoved out of the Roche-lobe and "sucked" into the star.