Note: I'll be using column vector notation (eg. $Ax=y$), thus if you are using row notation, transpose the matrix and multiply from the left instead of the right. (eg. $y=x^TA^T$)
A perspective transformation matrix transforms a view frustum into a rectangular view volume. Note that the resulting view volume might not be a cube and might not be centered at 0.
One example of a perspective transformation matrix. There are many more, and yours is included.
Let $l=left,\\ r = right,\\ b = bottom,\\ t = top,\\ n = near,\\ f = far$
$M_{persp}=\begin{bmatrix}
1& & & \\
&1& & \\
& &\frac{n+f}{n}&-f\\
& &\frac{1}{n}&
\end{bmatrix}$
Since the resulting view volume is not the canonical view volume, we need to apply another matrix.
A orthographic transformation matrix transforms a rectangular view volume into a cubic view volume with two corners at (-1, -1, -1) and (1, 1, 1), which happens to be the canonical view volume.
Intuitively it will need one translation and one scaling.
$\text{T}_{ortho} = S\left(\frac{2}{r-l},\frac{2}{t-b},\frac{2}{n-f}\right)T\left(\frac{-(l+r)}{2},\frac{-(b+t)}{2}\frac{-(n+f)}{2}\right)$
$M_{ortho} =
\begin{bmatrix}
\frac{2}{r-l}& & & \\
& \frac{2}{t-b} & & \\
& & \frac{2}{n-f} & \\
& & & 1
\end{bmatrix}
\begin{bmatrix}
1 & & & \frac{-(l+r)}{2} \\
& 1 & & \frac{-(b+t)}{2} \\
& & 1 & \frac{-(n+f)}{2} \\
& & & 1
\end{bmatrix}
$
$M_{ortho} =
\begin{bmatrix}
\frac{2}{r-l}& & & -\frac{l+r}{r-l} \\
& \frac{2}{t-b} & & -\frac{t+b}{t-b} \\
& & \frac{2}{n-f} & -\frac{n+f}{n-f}\\
& & & 1
\end{bmatrix}
$
Now you can combine them together to form a perspective projection matrix.
$M_{proj} = M_{ortho}M_{persp}$
$M_{proj} =
\begin{bmatrix}
\frac{2}{r-l}& & & -\frac{l+r}{r-l} \\
& \frac{2}{t-b} & & -\frac{t+b}{t-b} \\
& & \frac{2}{n-f} & -\frac{n+f}{n-f}\\
& & & 1
\end{bmatrix}
\begin{bmatrix}
1& & & \\
&1& & \\
& &\frac{n+f}{n}&-f\\
& &\frac{1}{n}&
\end{bmatrix}$
$M_{proj} =
\begin{bmatrix}
\frac{2n}{r-l}& & \frac{l+r}{l-r} & \\
& \frac{2n}{t-b} & \frac{b+t}{b-t} & \\
& & \frac{n+f}{n-f} & \frac{2fn}{f-n}\\
& & 1 &
\end{bmatrix}$
If you have a free-moving camera you will need a camera matrix too, thus the final projection matrix centered on the camera is.
$M_{proj} = M_{ortho}M_{persp}M_{camera}$