I haven't tried this but I think this should work:
For example your layout is 100.000px long and your screen size is 1024x768
Make the first 1024px and the last 1024px of your layout look identical.
Once the player.X>=(100000-1024/2), set its position to Player.X-(100000-1024)
This should teleport it to the beginning of the layout