I'm studying from the Stacks Project.
They say the proof is omitted. And they don't indicate the difficulty. I've tried piecing together commuting squares etc, but have found nothing useable.
Here's another attempt
$f : a \to b$ is representable iff for every other map $g: c \to b$ there is an object $d$ with arrows $p : d \to a, \ q : d \to c$ such that if $d'$ is another object with respective morphisms to $a, c$ such that $f \circ \alpha = g \circ \beta$, then there is a unique isomorphism $\gamma : d' \to d$ such that $p\circ \gamma = \alpha, \ q \circ \gamma = \beta$.
I added in the isomorphism part because it follows from Yoneda lemma.
So let prime notation indicate the other representable map $f' : b \to b'$ with $d', p', q', $ and any other map $g' : c' \to b'$. For some reason, I want to say that since it's for any other map that we should let $g'= f' \circ f : a \to b'$. Which then in a way includes the composition we're after.
Thanks @DerekElkins comments. The Pullback article on wikipedia, has a nice picture of the two pasted together commuting squares.
So I want to prove the isomorphism $(a \times_b c) \times_c d \simeq a \times_b d$ where $a \times_b c$ is the fibre product, also known as a pullback.
Let $a \times_b c$ together with $a \xrightarrow{f} b, \ c \xrightarrow{g} b$ be one pullback with projections $p: \to a, \ q :\to c$.
In other words let one pullback square be:
$$ \require{AMScd} \begin{CD} a\times_b c @>{q}>> a \\ @V{p}VV @VV{f}V \\ c @>{g}>>b \end{CD} $$
Now my mistake was to try and attach the second square on the right, but it actually fits nicely on the left.
So let $(a \times_b c) \times_c d$ be the next fiber product with $g' = p$ by choice since we have $h : d \to c$ is representable iff $\forall \ g': a\times_b c \to c$ there is a fiber product between $h$ and $g'$. So the two squares together become:
$$ \require{AMScd} \begin{CD} (a\times_b c)\times_c d @>{q'}>> a\times_b c @>{q}>> a \\ @V{p'}VV @V{p}VV @VV{f}V \\ d @>{h}>> c @>{g}>> b \end{CD} $$
Thus, letting $e = (a \times_b c) \times_c d$ we should have a pullback rectangle. That is, a fiber product between $gh$ and $f$. We need to show that for any $e'\xrightarrow{\alpha'} d, \ e' \xrightarrow{\beta'} b$ such that $gh \circ \alpha' = f \circ \beta'$ there exists a pullback morphism $e' \xrightarrow{u'} e$ such that $p'\circ u' = \alpha'$ and $qq'\circ u' = \beta'$.
Well, let $\alpha = h \circ \alpha', \ \beta = \beta'$ then $\alpha, \beta$ are the two corresponding pullback morphisms (in the definition) for the square on the right. So that there is a unique morphism $e'\xrightarrow{u} a\times_b c$ such that $p\circ u' = \alpha$ and $q \circ u' = \beta$. But then we can let $\beta'' = u'$ and we have $p\circ \beta'' = h \circ \alpha '$ already so that there must exist a unique morphism $e' \xrightarrow{u''} e$ such that $p'\circ u'' = \alpha'$ and $q'\circ u'' = \beta''$. But then $qq'\circ u'' = q\circ\beta'' = q \circ u' = \beta$, which goes to the upper-right corner of the full rectangle by definition.
That completes the proof via diagram chasing. $\square$
Thus, we have that there exists a fiber product $a \times_b d$ or that the composition of representable maps $g\circ h$ is also representable.