Epitaxial strain has been widely used to tune crystal and domain structures in ferroelectric thin films. New avenues of strain engineering based on varying the composition at the nanometer scale have been shown to generate symmetry breaking and large strain gradients culminating in large built-in potentials. In this work, we develop routes to deterministically control these built-in potentials by exploiting the interplay between strain gradients, strain accommodation, and domain formation in compositionally graded PbZr1-xTixO3 heterostructures. We demonstrate that variations in the nature of the compositional gradient and heterostructure thickness can be used to control both the crystal and domain structures and give rise to nonintuitive evolution of the built-in potential, which does not scale directly with the magnitude of the strain gradient as would be expected. Instead, large built-in potentials are observed in compositionally-graded heterostructures that contain (1) compositional gradients that traverse chemistries associated with structural phase boundaries (such as the morphotropic phase boundary) and (2) ferroelastic domain structures. In turn, the built-in potential is observed to be dependent on a combination of flexoelectric effects (i.e., polarization-strain gradient coupling), chemical-gradient effects (i.e., polarization-chemical potential gradient coupling), and local inhomogeneities (in structure or chemistry) that enhance strain (and/or chemical potential) gradients such as areas with nonlinear lattice parameter variation with chemistry or near ferroelastic domain boundaries. Regardless of origin, large built-in potentials act to suppress the dielectric permittivity, while having minimal impact on the magnitude of the polarization, which is important for the optimization of these materials for a range of nanoapplications from vibrational energy harvesting to thermal energy conversion and beyond.