The closest city to reach Sambor Prei Kuk is Kompong Thom.
There are many minivans and buses available from all major cities like Kep, Kampot, Siem Reap, Kratie and Phnom Penh. It takes between 4 to 6 hours, depending on the city of departure and costs between 20 to 30 USD per person.
From Kampong Thom, you can reach Sambor Prei Kuk by renting taxis which would cost about 30 USD for a one-way trip that can be shared.
It takes about 1 to 1.5 hours to reach. You can also get there by renting a motorbike or a Tuk-Tuk, which would cost between 10 to 20 USD per person and takes about an hour.