Tuning the pinning energy in layered superconductors