Axion-like particles are hypothetical new light (sub-eV) bosons predicted in some extensions of the Standard Model of particle physics. In astrophysical environments comprising high-energy gamma rays and turbulent magnetic fields, the existence of axion-like particles can modify the energy spectrum of the gamma rays. This modification would take the form of an irregular behavior of the energy spectrum in a limited energy range. Data from the H.E.S.S. observations of the distant BL Lac PKS 2155-304 are used to derive conservative upper limits on the strength of the axion-like particle coupling to photons. This study gives rise to the first exclusions on axion-like particles from gamma-ray astronomy. The derived constraints apply to both light pseudo-scalar and scalar bosons that couple to the electromagnetic field.