The intracellular microsporidian parasite Nosema ceranae is known to compromise bee health by induction of energetic stress and downregulation of the immune system. Porphyrins are candidate therapeutic agents for controlling Nosema infection without adverse effects on honeybees. In the present work, the impact of two protoporphyrin IX derivatives, i.e. PP[Asp]2 and PP[Lys]2, on Apis mellifera humoral immune response has been investigated in laboratory conditions in non-infected and N. ceranae-infected honeybees. Fluorescence spectroscopy analysis of hemolymph showed for the first time that porphyrin molecules penetrate into the hemocoel of honeybees. Phenoloxidase (PO) activity and the expression of genes encoding antimicrobial peptides (AMPs: abaecin, defensin, and hymenoptaecin) were assessed. Porphyrins significantly increased the phenoloxidase activity in healthy honeybees but did not increase the expression of AMP genes. Compared with the control bees, the hemolymph of non-infected bees treated with porphyrins had an 11.3- and 6.1-fold higher level of PO activity after the 24- and 48-h porphyrin administration, respectively. Notably, there was a significant inverse correlation between the PO activity and the AMP gene expression level (r = − 0.61696, p = 0.0143). The PO activity profile in the infected bees was completely opposite to that in the healthy bees (r = − 0.5118, p = 0.000), which was related to the changing load of N. ceranae spores in the porphyrin treated-bees. On day 12 post-infection, the spore loads in the infected porphyrin-fed individuals significantly decreased by 74%, compared with the control bees. Our findings show involvement of the honeybee immune system in the porphyrin-based control of Nosema infection. This allows the infected bees to improve their lifespan considerably by choosing an optimal PO activity/AMP expression variant to cope with the varying level of N. ceranae infection.