  We study the implementation of a high fidelity controlled-phase gate in a
Rydberg quantum computer. The protocol is based on a symmetric gate with
respect to the two qubits as experimentally realized by Levine et al [Phys.
Rev. Lett. 123, 170503 (2019)], but allows for arbitrary pulse shapes with
time-dependent detuning. Optimizing the pulse shapes, we introduce laser pulses
which shorten the time spent in the Rydberg state by 10% and reduce the leading
contribution to the gate infidelity, i.e., the decay from the Rydberg state.
Remarkably, this reduction can be achieved for smooth pulses in detuning and
smooth turning on of the Rabi frequency as required in any experimental
realization. We carefully analyze the influence of fundamental error sources
such as the photon recoil, the microscopic interaction potential, as well as
the harmonic trapping of the atoms for an experimentally realistic setup based
on strontium-88 atoms. We find that an average gate fidelity above 99.9% is
possible for a very conservative estimation of experimental parameters.
