(This is taken from Guillermo Grabinsky's Measure Theory notes, at the Facultad de Ciencias, UNAM, Mexico City, Fall of 1991).
More generally, if $(X,S,\mu)$ is a finite measure space ($S$ is a $\sigma$-algebra, $\mu(X)\lt \infty$, $S$ is $\mu$-complete (if $A\in S$ has $\mu(A)=0$, and $B\subseteq A$, then $B\in S$), and $f\colon X\to\mathbb{R}$ is nonnegative and bounded, then $\inf_{f\leq\psi}\int\psi(x)\;\text{d}x=\sup_{f\geq\phi}\int\phi(x)\;\text{d}x ~,$ implies that $f$ is measurable.
The idea is that we can find a sequence of simple functions $\psi_n$ that are "over" $f$, and a sequence of simple functions $\phi_n$ that are "under" $f$, and such that the difference between the integral of $\psi_n$ and of $\phi_n$ is less than $\frac{1}{n}$; that is, we turn the equality of infimum and supremum into a sequence of simple functions under $f$ whose integrals converges to the supremum, a sequence of simple functions over $f$ whose integrals converge to the infimum, and which are close to one another at each step, and getting closer. Our function $f$ is getting trapped in between $\phi_n$ and $\psi_n$. Then we want to show that the set of points in which $\phi_n$ and $\psi_n$ are at least $\frac{1}{m}$ apart will grow smaller as $n$ increases, until it has measure $0$ at the end (which makes sense: if you had some $m$ such that the set of points in which $\phi_n$ and $\psi_n$ are at least $\frac{1}{m}$ apart always has measure at least $\epsilon$, then the limit of the difference of the integrals, which equals the difference of the limits of the integrals, would have to be at least $\frac{\epsilon}{m}$, contradicting that the limits are supposed to be equal). That means that the set of points where the limit of the $\phi_n$ is strictly smaller than the limit of the $\psi_n$ has measure zero, so that $f$ will be equal to the limit of simple functions outside a set of measure $0$. Provided the domain space is complete, that suffices to show that $f$ is measurable, since it will be equal to a limit of simple functions almost everywhere.
Indeed, since we have equality, for every $n\in\mathbb{N}$ there exist functions $\psi_n$ and $\phi_n$ that are simple, $\phi_n\leq f\leq \psi_n$, and such that $\inf_{f\leq\psi}\int\psi(x)\;\text{d}x - \sup_{f\geq\phi}\int\phi(x)\;\text{d}x\leq \frac{1}{n}.$
(Aside: This gives us a bit more control over the simple functions; it's easier to work with specific sequences whose limits are the inf and sup we want, rather than with the sets themselves, and it also gives us simultaneous control over both sets.)
Let $\phi^*=\sup\phi_n$ and $\psi_*=\inf\psi_n$. Then $\psi^*$ and $\phi_*$ are measurable (infimum and supremum of simple functions), and $\phi^*\leq f\leq \psi_*$. Let $N$ be the set $N = \{ x\in X\mid \psi_*(x) - \phi^*(x)\gt 0\}.$
(Aside: We want to show that $N$, the set where these limits disagree, has measure $0$)
Then $N=\cup_{m=1}^{\infty}N_m$, where $N_m = \left\{x\in X\ \left|\ \psi_*(x)-\phi^*(x)\geq \frac{1}{m}\right.\right\}\subseteq \left\{x\in X\ \left|\ \psi_n(x)-\phi_n(x)\geq\frac{1}{m}\right.\right\}=N_m(n).$ I claim that $\mu(N_m)=0$ for all $m$, hence $\mu(N)=0$.
(Aside: Since what we have is good control over the $\psi_n$ and $\phi_n$, rather than over $\psi_*$ and $\phi^*$, we replace $N$ with sets that contain them but are defined in terms of $\psi_n$ and $\phi_n$; if we can show these sets have measure going to $0$ as $n\to\infty$, that will do it by monotonicity)
By construction, $1\leq m(\psi_n(x)-\phi_n(x))$ if and only if $x\in N_m(n)$, so $\chi_{N_m(n)} \leq m\chi_{N_m(n)}(\psi_n(x) - \phi_n(x)),$ and the latter is measurable and nonnegative. Hence $\begin{align*} \mu(N_m(n)) &= \int \chi_{N_m(n)}\,d\mu\\ &= m\int\chi_{N_m(n)}(\psi_n-\phi_n)\,d\mu\\ &\leq m \int (\psi_n-\phi_n)\,d\mu\\ &= m\left(\int \psi_n\,d\mu - \int\phi_n\,d\mu\right) \\ &\leq \frac{m}{n}. \end{align*}$ Since $N_m\subseteq N_m(n)$ for all $n$, and $\mu(N_m(n))\leq \frac{m}{n}$, it follows that $\mu(N_m)\leq \frac{m}{n}$ for all $n$, hence $\mu(N_m)=0$.
(Aside: So, using the fact that simple functions are "well-behaved", we can bound the measure of the $N_m(n)$, which in turn gives us enough information about $N_m$ to show it has measure zero; and so the set $N$, which is a union of the $N_m$, has measure zero as well)
Therefore, $\phi_*=\psi^*$ $\mu$-almost everywhere, hence $\phi_*=f=\psi^*$ $\mu$-almost everywhere. Since we are assuming that $(X,S,\mu)$ is complete, that means that $f$ is measurable. QED
In your case, you are presumably working with the Lebesgue measure on both domain and range, so that it is complete; and since $f$ is bounded, modifying it by adding a suitable constant will yield a measurable nonnegative function, so the result applies.
As t.b. rightly points out, this is an instance of a general theme, that "measurable" means that the "inner measure" and the "outer measure" coincide. Here, you can view the supremum of the integrals over the $\phi$ as a kind of "inner integral", and the infimum of the integrals over the $\psi$ as a kind of "outer integral", so we are saying that $f$ is measurable when these two agree.