Hypothetical low-mass particles, such as axions, provide a compelling explanation for the dark matter in the universe. Such particles are expected to emerge abundantly from the hot interior of stars. To test this prediction, the CERN Axion Solar Telescope (CAST) uses a 9 T refurbished Large Hadron Collider test magnet directed towards the Sun. In the strong magnetic field, solar axions can be converted to X-ray photons which can be recorded by X-ray detectors. In the 2013–2015 run, thanks to low-background detectors and a new X-ray telescope, the signal-to-noise ratio was increased by about a factor of three. Here, we report the best limit on the axion–photon coupling strength (0.66 × 10−10 GeV−1 at 95% confidence level) set by CAST, which now reaches similar levels to the most restrictive astrophysical bounds.