  The Fe$_5$PB$_2$ compound offers tunable magnetic properties via the
possibility of various combinations of substitutions on the Fe and P-sites.
Here, we present a combined computational and experimental study of the
magnetic properties of (Fe$_{1-x}$Co$_{x}$)$_5$PB$_2$. Computationally, we are
able to explore the full concentration range, while the real samples were only
obtained for 0 <= x <= 0.7. The calculated magnetic moments, Curie
temperatures, and magnetocrystalline anisotropy energies (MAEs) are found to
decrease with increasing Co concentration. Co substitution allows for tuning
the Curie temperature in a wide range of values, from about six hundred to zero
kelvins. As the MAE depends on the electronic structure in the vicinity of
Fermi energy, the geometry of the Fermi surface of Fe$_5$PB$_2$ and the
k-resolved contributions to the MAE are discussed. Low temperature measurements
of an effective anisotropy constant for a series of
(Fe$_{1-x}$Co$_{x}$)$_5$PB$_2$ samples determined the highest value of 0.94 MJ
m$^{-3}$ for the terminal Fe$_5$PB$_2$ composition, which then decreases with
increasing Co concentration, thus confirming the computational result that Co
alloying of Fe$_5$PB$_2$ is not a good strategy to increase the MAE of the
system. However, the relativistic version of the fixed spin moment method
reveals that a reduction in the magnetic moment of Fe$_5$PB$_2$, by about 25%,
produces a fourfold increase of the MAE. Furthermore, calculations for
(Fe$_{0.95}$X$_{0.05}$)$_5$PB$_2$ (X = 5$d$ element) indicate that 5% doping of
Fe$_5$PB$_2$ with W or Re should double the MAE. These are results of high
interest for, e.g., permanent magnet applications, where a large MAE is
crucial.
