Define $S$ by
$$ S = A^{-\frac{1}{2}} \left( A^{\frac{1}{2}} B A^{\frac{1}{2}}\right)^{\frac{1}{2}} A^{-\frac{1}{2}}. $$
Then $S$ is symmetric and so, by Theorem 2 of Wigner's "On Weakly Positive Matrices", $S$ is positive definite and
$$ SAS = A^{-\frac{1}{2}} \left( A^{\frac{1}{2}} B A^{\frac{1}{2}}\right)^{\frac{1}{2}} A^{\frac{1}{2}} A^{-\frac{1}{2}} \left( A^{\frac{1}{2}} B A^{\frac{1}{2}}\right)^{\frac{1}{2}} A^{-\frac{1}{2}} = A^{-\frac{1}{2}} \left( A^{\frac{1}{2}} B A^{\frac{1}{2}}\right) A^{-\frac{1}{2}} = B. $$
The matrix $S$ is the unique positive definite matrix satisfying $SAS = B$. To see this, let $S$ be a positive definite matrix satisfying $SAS = B$ and define $S' = A^{\frac{1}{2}}SA^{\frac{1}{2}}$. Then $S'$ is also positive definite and we have
$$ S'^2 = A^{\frac{1}{2}}SA^{\frac{1}{2}}A^{\frac{1}{2}}SA^{\frac{1}{2}} = A^{\frac{1}{2}}BA^{\frac{1}{2}}. $$
The right hand side is also positive definite and so, by the uniqueness of the positive definite square root, $S'$ is determined uniquely which implies that $S$ is determined uniquely (as $A$ is invertible).