We extend field patching to the setting of Berkovich analytic geometry and use it to prove a local–global principle over function fields of analytic curves with respect to completions. In the context of quadratic forms, we combine it with sufficient conditions for local isotropy over a Berkovich curve to obtain applications on the $u$-invariant. The patching method we adapt was introduced by Harbater and Hartmann [Patching over fields, Israel J. Math. 176 (2010), 61–107] and further developed by these two authors and Krashen [Applications of patching to quadratic forms and central simple algebras, Invent. Math. 178 (2009), 231–263]. The results presented in this paper generalize those of Harbater, Hartmann, and Krashen [Applications of patching to quadratic forms and central simple algebras, Invent. Math. 178 (2009), 231–263] on the local–global principle and quadratic forms.