  Let $G= N\rtimes H$ be a locally compact group which is a semi-direct product
of a closed normal subgroup $N$ and a closed subgroup $H.$ The Bohr
compactification ${\rm Bohr}(G)$ and the profinite completion ${\rm Prof}(G)$
of $G$ are, respectively, isomorphic to semi-direct products $ Q_1 \rtimes {\rm
Bohr}(H)$ and $ Q_2 \rtimes {\rm Prof}(H)$ for appropriate quotients $Q_1$ of
${\rm Bohr}(N)$ and $Q_2$ of ${\rm Prof}(N).$ We give a precise description of
$Q_1$ and $Q_2$ in terms of the action of $H$ on appropriate subsets of the
dual space of $N$. In the case where $N$ is abelian, we have ${\rm
Bohr}(G)\cong A \rtimes {\rm Bohr}(H)$ and ${\rm Prof}(G)\cong B \rtimes {\rm
Prof}(H),$ where $A$ is the group of unitary characters of $N$ with finite
$H$-orbits and $B$ the subgroup of $A$ of characters with finite image.
Necessary and sufficient conditions are deduced for $G$ to be maximally almost
periodic or residually finite. We apply the results to the case where $G=
\Lambda\wr H$ is a wreath product of countable groups; we show in particular
that ${\rm Bohr}(\Lambda\wr H)$ is isomorphic to ${\rm Bohr}(\Lambda^{\rm
Ab}\wr H)$ and ${\rm Prof}(\Lambda\wr H)$ is isomorphic to ${\rm
Prof}(\Lambda^{\rm Ab} \wr H),$ where $\Lambda^{\rm Ab}=\Lambda/ [\Lambda,
\Lambda]$ is the abelianization of $\Lambda.$ As examples, we compute ${\rm
Bohr}(G)$ and ${\rm Prof}(G)$ when $G$ is a lamplighter group and when $G$ is
the Heisenberg group over a unital commutative ring.
