In upcoming work of Ben-Zvi-Sakellaridis-Venkatesh, (see for instance these notes or this lecture) some important aspects of the Langlands correspondence are stated in the language of topological quantum field theory. We have a TQFT i.e. a functor $A_G$, and it takes for example, a curve $C$ over $\mathbb{F}_{q}$ and returns the vector space $A_G(C)$ of unramified automorphic forms which live on $\mathrm{Bun}_G(C)$. It can further take a local field $F_x$ (localization of the function field of $C$ at some point $x$ of $C$) and return the category $A_G(F)$ of smooth representations of $G(F_x)$, and we can put them together and apply $A_G$ to $C\setminus S$, $S$ a finite set of places, to get $A_G(C\setminus S)$, the vector space of automorphic forms with prescribed ramification at $S$. In this picture, we are taking $C$ and the formal puncture disc around $x$ to be the analogues of $2$-manifolds and circles in 2D TQFT.

It has been mentioned that this is in some way related to (or perhaps inspired by) the work of Kapustin and Witten on gauge theory and geometric Langlands (over $\mathbb{C}$). In this work Kapustin and Witten construct a topological field theory on a manifold of the form $M=\Sigma\times C$ where $C$ is the Riemann surface of geometric Langlands, and, upon taking $C$ to be small compared to $\Sigma$, they show that the effective field theory on $\Sigma$ can be described by a sigma model of maps from $\Sigma$ to $\mathcal{M}_{H}(G)$, the moduli of semistable Higgs bundles on $C$. Then by some construction involving the "canonical coisotropic brane" in section 11 of that paper they make contact with the Langlands program by describing how to build a sheaf of D-modules on $\mathrm{Bun}_G$. Then S-duality on the gauge theory makes ${}^{L}G$ appear and the hyperkahler nature of $\mathcal{M}_{H}({}^{L}G)$/nonabelian Hodge correspondence connects this with the moduli of vector bundles with flat connection and the geometric Langlands correspondence appears as homological mirror symmetry between $\mathcal{M}_{H}(G)$ and $\mathcal{M}_{H}({}^{L}G)$.

The work of Kapustin-Witten, in their paper is a "topological field theory" in that it is independent of the metric. The language of TQFT as a functor, as far as I know, does not show up in the paper (although it does get a little mention in this later survey by Kapustin).

In the talks of Ben-Zvi linked to above, the TQFT that they are considering is supposed to actually go up to 4-dimensions, and though the examples I mentioned in the first paragraph are just the 2- and 1-dimensional part. From what I infer this being 4-dimensional is supposed to be somewhat connected to Kapustin-Witten.

How does one reconcile the two? What is the 4-dimensional part of the TQFT of Ben-Zvi-Sakellaridis-Venkatesh? How is this related to the manifold $M=\Sigma\times C$ of Kapustin-Witten? In the MSRI notes linked above, there is a table on page 9 which says the 4-dimensional part should be periods. How is this so? In the same work periods are also supposed to be related to boundary conditions, which pick out a specific object of the output of the TQFT. However in the survey of Kapustin (in section 0.5) boundary conditions are the output of the 0-dimensional part of a 2-dimensional TQFT. What should the 3-dimensional part be?