I came across a similar question here, which should guarantee that $B$ is nilpotent, but I wonder if knowing that the matrices are similar (not just having the same eigenvalues) is enough to conclude that $B = 0$. I'm particularly interested in the case where $A$ is diagonalizable, but I would not be surprised if that isn't relevant here.
I considered using the Jordan-Chevalley decomposition to show that $B = 0$ since if $A = P(A + tB)P^{-1}$ for $t \neq 0$, we have $A = A + 0$ as well as $A = PAP^{-1} + tPBP^{-1}$, where $A$ and $PAP^{-1}$ are diagonalizable and $0$ and $tPBP^{-1}$ are nilpotent. However, I don't know that $A$ and $B$ commute, so this decomposition is not necessarily unique. Any help would be appreciated.