Let $L$ denote the set of $3$-manifolds which can be obtained by gluing the boundaries of two solid tori $S^1\times B^2$ using a homeomorphism. The questions asks us to determine the maximum value obtained by the function $$ d:L\rightarrow \mathbb{Z}\quad \hbox{given by $d(M)=\sum_i\dim H_i(M;\mathbb{Z}/5).$} $$ After reading around online I've learned that every $M\in L$ will be a lens space $L(p,q)$. I think the universal coefficient theorem then implies that $d(M)=4$ is the maximum and is attained when $M=L(p,q)$ with $p$ divisible by $5$.
Can anyone see a way to prove this without using the fact that every $M\in L$ is a lens space? For example, I think it's possible to show $8$ is an upper-bound for $d$ by observing that every $M\in L$ has a CW-structure with exactly eight cells. To be precise I think that $M$ has CW-structure with exactly one $0$-cell, two $1$-cells, three $2$-cells, and two $3$-cells.
Let $M$ be such a manifold. We want to compute its homology with coefficients in $\Bbb F_5$. One might as well compute it over $\Bbb F_p$ for any prime $p$. For convenience I'll write $H_i(M)$ for $H_i(M;\Bbb F_p)$
As $M$ is orientable, and we are working over a field, we have $H_0(M)\cong H_3(M)\cong\Bbb F_p$ and $\dim H_1(M)=\dim H_2(M)$. So we only need to compute one of $\dim H_1(M)$ and $\dim H_2(M)$.
We can write $M=A_1\cup A_2$ where the $A_i$ are the solid tori $B^2\times S^1$. Then $A_1\cap A_2=T$ is a torus $S^1\times S^1$. The Mayer-Vietoris sequence is valid. We get in part $$\cdots\to H_1(T)\to H_1(A_1)\oplus H_1(A_2)\to H_1(M)\to H_0(T)\to H_0(A_1)\oplus H_0(A_2)\to H_0(M)\to0.$$ The connecting map $H_1(M)\to H_0(T)$ is zero, so $H_1(M)$ is the cokernel of $H_1(T)\mapsto H_1(A_1)\oplus H_1(A_2)$.
Each map $H_1(T)\to H_1(A_i)$ is a nonzero map $f_i$ from $H_1(T)\cong \Bbb F_p^2$ to $H_1(A_1)\cong\Bbb F_p$. (It kills one generator of $H_1(T)$ and takes the other to a generator of $H_1(A_i)$.) These $f_i$ may or may not have the same kernel. In the first case the image of $H_1(T)$ in $H_1(A_1)\oplus H_1(A_2)$ has dimension $1$, in the latter it is surjective. So $\dim H_1(M)$ may be $0$ or $1$, and so the overall dimension of $H_*(M)$ is either $2$ or $4$.