We generalize the construction of M. Lieblich for the compactification of the moduli stack of $PGL_r$-bundles on algebraic spaces to the moduli stack of Tanaka-Thomas $PGL_r$-Higgs bundles on algebraic schemes. The method we use is the moduli stack of Higgs version of Azumaya algebras. In the case of smooth surfaces, we obtain a virtual fundamental class on the moduli stack of $PGL_r$-Higgs bundles. An application to the Vafa-Witten invariants is discussed.