Where is the potential energy due to internal interactions in total energy? In thermodynamics the total energy of a system consists of kinetic energy of motion of the system as a whole, potential energy of the system as a whole due to external force fields, and energy contained within the system known as internal energy,
$$
    E = E_{\mathrm{k}} + E_{\mathrm{p}} + U \, . \tag{1}
$$
That is the way it is said in many books, lecture notes and online source. For instance, the first paragraph of Wikipedia article on internal energy says:

In thermodynamics, the internal energy is one of the two cardinal
  state functions of the state variables of a thermodynamic system. It
  refers to energy contained within the system, and excludes kinetic
  energy of motion of the system as a whole, and the potential energy of
  the system as a whole due to external force fields. It keeps account
  of the gains and losses of energy of the system.

Well, if a system is just one macroscopic body, I have no problems with these definition. But what if we have more than one body in our system?
Consider, for instance, an isolated system composed of two bodies of mass $m_{1}$ and $m_{2}$. According to classical mechanics, between two masses there always always exists a gravitational force
$$
    F = \frac{G m_{1} m_{2}}{r_{12}^2} \, ,
$$
and there exist a gravitational potential energy 
$$
    V = - \frac{G m_{1} m_{2}}{r_{12}} \, ,
$$
due to this interaction.
Now, this potential energy $V$ is not a part of $E_{\mathrm{p}}$ in (1), since it is not due to external, but rather internal force field.
Clearly, it is also not a part of $E_{\mathrm{k}}$.
Where is it then? Is it included into internal energy $U$ or it is just an additional term for the total energy that has nothing to do with internal energy $U$?
In other words, the increase in which quantity (according to the 1st law of thermodynamics) is equal to the heat supplied to the system plus the work done on it: internal energy counted with or without this potential energy $V$ due to gravitational interaction?
 A: The gravitational potential for particle 1 is $V_1(r_{12}) = -Gm_2/r_{12}$ and for particle 2 it is $V_2(r_{12}) = -Gm_1/r_{12}$. $m_2$ is in $V_1$ and vice versa because the gravitational potential energy is the potential energy in a gravitational field per unit mass, and therefore only depends on the mass that is generating that gravitational field. When you multiply by mass to go from gravitational potential to potential energy, you get the result you have above. I'm just clarifying by own notation of $V$ which is different from yours.

Is it included into internal energy U

The "internal potential" energy as you seem to think about it is called the gravitational binding energy), and is defined as being the answer to the following question : How much energy would I gain if I break up your system by separating the masses by an infinite distance ? This is equivalent to wondering how much energy it would take to transport $m_1$ to infinity while holding $m_2$ fixed, where the internal energy is the opposite of this amount (we could do it the other way around by switching $m_1$ and $m_2$ and get the same answer) :
\begin{eqnarray}
U_{grav} &=& m_1 \times V_1(r_{12}) - m_1 \times \underbrace{V_1(\infty)}_0 \\
 &=& -G m_1 m_2/r_{12}
\end{eqnarray}
Once $m_1$ is at $\infty$, it takes $0$ work to move $m_2$ to $\infty$ as well. The fact that the answer is negative is just telling you that you would actually lose energy by breaking up the system, and gain energy by forming it. Hope this helps. Let me know if you have any questions.
If you had two blobs of matter with masses $m_1$ and $m_2$ then their internal thermodynamic energy $U_{thermo}$ is not affected by any of this. The total energy is then :
$$
E_{tot} = E_k + E_p + U_{thermo} + U_{grav}
$$
So your equation $(4)$ is the correct one. Whether this means that the total internal energy is $U + V$ or just $U$ depends on how you define internal energy, but given the Wikipedia definition :

It refers to energy contained within the system, and excludes kinetic energy of motion of the system as a whole, and the potential energy of the system as a whole due to external force fields. It keeps account of the gains and losses of energy of the system.

It therefore refers to $U + V$. The definition explicitly states that only potentials due to external force fields are excluded, not the internal ones as well as you have written.
A: Your separation into potential energy of the system as a whole due to external force fields and energy contained within the system known as internal energy seems a bit arbitrary. Still, if you want to split the PE up this way gravitational interactions within the system would have to go into internal energy.
Take the Solar System as an example. Everything in the Solar System sits within the gravitational field of the Milky Way, so you could assign a potential energy due to the external gravitational field of the Milky Way. However there's obviously also the potential energy due to the mutual gravitational attraction of the Sun, planets etc. You would have to treat this as internal energy.
Then you've got the potential energy of the Moon within the Earth's gravitational field, the potential energy of all the rock that went into making up the Earth and so on.
I guess splitting up the different effects can be useful - we don't consider the gravitational field of the Milky Way when calculating trajectories of spacecraft. But the splitting can be done in loads of different ways depending on what particular aspect of the Solar System you're looking at.
A: In principle, the gravitational potential energy should be included into total internal energy, but in practice, most often it is not. I know of two reasons.


*

*because for systems that are discussed in thermodynamics, it is believed that gravitational energy is negligible compared to electromagnetic potential energy of the constituting particles;

*because it is difficult to include $1/r^2$ forces such as electromagnetic or gravitational force to calculations based on standard statistical physics in a unique and convincing way.
