We explicitly derive Lax pairs for string theories on Yang-Baxter deformed backgrounds, 1) gravity duals for noncommutative gauge theories, 2) $gamma$-deformations of S$^5$, 3) Schrodinger spacetimes and 4) abelian twists of the global AdS$_5$,. Then we can find out a concise derivation of Lax pairs based on simple replacement rules. Furthermore, each of the above deformations can be reinterpreted as a twisted periodic boundary conditions with the undeformed background by using the rules. As another derivation, the Lax pair for gravity duals for noncommutative gauge theories is reproduced from the one for a $q$-deformed AdS$_5times$S$^5$ by taking a scaling limit.