We show that if
$A\subset \{1,\ldots ,N\}$ does not contain any nontrivial solutions to the equation
$x+y+z=3w$, then
$$\begin{eqnarray}|A|\leqslant \frac{N}{\exp (c(\log N)^{1/7})},\end{eqnarray}$$ where
$c>0$ is some absolute constant. In view of Behrend’s construction, this bound is of the right shape: the exponent
$1/7$ cannot be replaced by any constant larger than
$1/2$. We also establish a related result, which says that sumsets
$A+A+A$ contain long arithmetic progressions if
$A\subset \{1,\ldots ,N\}$, or high-dimensional affine subspaces if
$A\subset \mathbb{F}_{q}^{n}$, even if
$A$ has density of the shape above.