Can the Hamiltonian operator act on a bra, if it was once acting on a ket?

Yes, it is legal.

To give some motivation of why this sort of integral-of-a-derivative operator might simplify in the way that you are considering, let's consider a very simple example far away from our normal concerns of normalizing wavefunctions and making sure things are Hermitian: Suppose your operator is $\partial_x$ and your bra is $x^2$, and we ignore the fact that things can be complex-valued for the moment: then acting on some arbitrary $f$ we are writing the left hand side as a shorthand for the right hand side in:$$\langle x^2\rvert\partial_x\lvert f\rangle = \int_{-\infty}^\infty dx~x^2 f'(x).$$ But of course after integrating by parts we would have, $$ \begin{align} \langle x^2\rvert\partial_x\lvert f\rangle &= \left[x^2 f(x)\right]_{-\infty}^\infty -\int_{-\infty}^\infty dx~2x f(x) \\ &= \langle -2x\rvert f\rangle, \end{align} $$ assuming appropriate decay properties of $f$ at infinity to remove the boundary term. So an integral-of-derivatives can sometimes be coerced into an equivalent plain integral. And you can also see that we have something that almost looks like the derivative of the left hand side, but has a frustrating minus sign.

The specific property that we are targeting here is the Hermitian or self-adjoint property which says that $H = H^\dagger$, or in mathematician's notation that $$\langle H \phi, \psi\rangle = \langle \phi, H \psi\rangle.$$This is not a trivial property and above we saw that just $\partial_x$ by itself does not satisfy this property; it satisfies a related property where it is called anti-self-adjoint or skew-Hermitian or so, $\nabla^\dagger = -\nabla.$ You may already know that $p$ as an operator does, which means that $i \partial_x$ has this property when we are careful with our negatives, because the negative sign gets absorbed into the complex conjugate operation: $$ \begin{align} \langle \phi|i\partial_x|\psi\rangle &= \int dx~\phi^*(x)~i\partial_x~\psi(x) \\&= i[\phi^* \psi] - \int dx~\psi(x)~i\partial_x\phi^*(x) \\&= +\int dx~\psi(x)~ (i \partial_x \phi(x))^* \\&= \langle i\partial_x\phi|\psi\rangle. \end{align} $$ (This is a little more easy to see in mathematicians’ notation, $\langle \phi, i\nabla\psi\rangle = i\langle\phi,\nabla\psi\rangle =i\langle-\nabla\phi,\psi\rangle$ by what we just proved and then the rest is just $ =\langle-(-i)\nabla\phi, \psi\rangle = \langle i\nabla\phi,\psi\rangle.$ As a corollary, any anti-self-adjoint operator can be made self-adjoint by multiplying by $\pm i$ and vice versa.)

The reason that we care about this property is that in quantum mechanics we want all of our predictions to be expectation values of the form $$\langle A\rangle_\psi = \langle \psi| A|\psi\rangle.$$ Taking the complex conjugate and remembering that $\big(\langle a | b | c\rangle\big)^* = \langle c|b^\dagger |a\rangle$ we find that the complex conjugate of this expression is $$\langle A\rangle_\psi^* = \langle \psi|A^\dagger|\psi\rangle,$$ and so if we want a real-valued observable whose predictions always equal its complex conjugate no matter what the state is, we need to require that such an observable is self-adjoint.

The rules about the adjoints of operators are very simple, $(AB)^\dagger = B^\dagger A^\dagger$ and $(A + B)^\dagger = A^\dagger + B^\dagger$, so that you can take products of self-adjoint operators to get new self-adjoint operators only if the two commute, and you can take arbitrary sums of self-adjoint operators. Thus your typical single-particle Hamiltonian $H = -(\hbar^2/2m) \nabla^2 + U(\vec r)$, is manifestly self-adjoint because clearly $-\nabla^2$ is the product of two self-adjoint operators $(i\nabla)\cdot(i\nabla)$ and every operator commutes with itself, plus $U(x)$ is obviously self-adjoint, and finally the sum is self-adjoint.

These properties are what allow us to so confidently assert that $\langle \psi_k|H = E_k \langle \psi_k|,$ we know that $H|\psi_k\rangle = E_k|\psi_k\rangle$ on the right hand side, but since $H$ is self-adjoint we know that we can also apply it to the left-hand side just as well, to get a real number $E_k$.