The Tunnel Under The World by Frederik Pohl

A man finds himself waking to the same June day over and over with only vague, recurring memories; as the repetitions accumulate he investigates the glitches and eventually discovers that the town and its people are an artificial reconstruction — tiny replicas whose experiences are being reset nightly and replayed as part of cruel experiments by those testing consumer responses — and he and a few others struggle to understand and escape the manufactured loop.

Purchase from Bookshop.org