The trick is to think backward. Normally you paint shadows in the recesses of a model and then highlights on the edges emphasising how the external light plays on the shape. Fire has a light of its own and so the roles are reversed and the deeper you go, the lighter it will be.
Note on colour: dependent on the substance being burned a fire can have different colours, like: red for wood, blue for natural gas and alcohol, green for boric acid or violet for potassium salts. Even in a realistic setting you can choose any colour you like. The lightest you can go is pure white for substances with high temperatures and uniform light emission.
1. Paint the flame in a lightest colour you want to have. For a classic wood fire it is yellow.
2. Put very thin layers of darker and more reddish colours on protruding flames. Classically orange and then red.
3. Finish with thin layers of black on the parts most distant from the flame core.