In self-organized criticality (SOC) models, as well as in standard phase transitions, criticality is only present for vanishing driving external fields $h rightarrow 0$. Considering that this is rarely the case for natural systems, such a restriction poses a challenge to the explanatory power of these models. Besides that, in models of dissipative systems like earthquakes, forest fires and neuronal networks, there is no true critical behavior, as expressed in clean power laws obeying finite-size scaling, but a scenario called dirty criticality or self-organized quasi-criticality (SOqC). Here, we propose simple homeostatic mechanisms which promote self-organization of coupling strengths, gains, and firing thresholds in neuronal networks. We show that near criticality can be reached and sustained even in the presence of external inputs because the firing thresholds adapt to and cancel the inputs, a phenomenon similar to perfect adaptation in sensory systems. Similar mechanisms can be proposed for the couplings and local thresholds in spin systems and cellular automata, which could lead to applications in earthquake, forest fire, stellar flare, voting and epidemic modeling.