I've already proved this with B positive definite using the fact that $B^{-\frac{1}{2}}$ does exist and AB is similar to $A^{\frac{1}{2}}BA^{\frac{1}{2}}$, but since B is positive semi-definite I don't know if that is true. I also know that $A^{\frac{1}{2}}$ and $B^{\frac{1}{2}}$ are defined.
I´m trying to see that $A^{\frac{1}{2}}BA^{\frac{1}{2}}$ is similar to $A^{\frac{1}{2}}A^{\frac{1}{2}}B$, but i'm having problems with that.
Any hint would help, thanks!
By a change of orthonormal basis, we may assume that $$ A=\pmatrix{A_{r\times r}'&0\\ 0&0_{(n-r)\times(n-r)}} \text{ and } B=\pmatrix{B_{r\times r}'&\ast\\ \ast&B_2}, $$ where $A'$ is positive definite. Then, by performing another change of orthonormal basis (or by orthogonally diagonalising $B'$, followed by permuting the diagonal entries of $B'$), we may further assume that $$ A=\pmatrix{A_1&X^T&0\\ X&A_2&0\\ 0&0&0} \text{ and } B=\pmatrix{B_1&0&Y^T\\ 0&0&Z^T\\ Y&Z&B_2}, $$ where $A'=\pmatrix{A_1&X^T\\ X&A_2}$ and $B'=\pmatrix{B_1&0\\ 0&0}$, with $B_1$ being positive definite. However, since $B$ is positive semidefinite, the sub-block $Z$ must be zero. It follows that $$ AB =\pmatrix{A_1&X^T&0\\ X&A_2&0\\ 0&0&0}\pmatrix{B_1&0&Y^T\\ 0&0&0\\ Y&0&B_2} =\pmatrix{A_1B_1&0&AY^T\\ XB_1&0&XY^T\\ 0&0&0} $$ is similar to the positive semidefinite matrix $A_1^{1/2}B_1A_1^{1/2}\oplus0\oplus0$: \begin{aligned} &\pmatrix{A_1^{-1/2}&0&A_1^{-1/2}B_1^{-1}Y^T\\ -XA_1^{-1}&I&0\\ 0&0&I} \pmatrix{A_1B_1&0&AY^T\\ XB_1&0&XY^T\\ 0&0&0} \pmatrix{A_1^{1/2}&0&-B_1^{-1}Y^T\\ XA_1^{-1/2}&I&-XA_1^{-1}B_1^{-1}Y^T\\ 0&0&I}\\ &=\pmatrix{A_1^{1/2}B_1&0&A_1^{1/2}Y^T\\ 0&0&0\\ 0&0&0} \pmatrix{A_1^{1/2}&0&-B_1^{-1}Y^T\\ XA_1^{-1/2}&I&-XA_1^{-1}B_1^{-1}Y^T\\ 0&0&I}\\ &=\pmatrix{A_1^{1/2}B_1A_1^{1/2}&0&0\\ 0&0&0\\ 0&0&0}. \end{aligned} Hence $AB$ is diagonalisable.