The trick is reducing the contrast in the scene. Fire's going to be much brighter than its surroundings, so it's a bugger to expose for. Using on-camera flash almost always uglies everything up like that, though. To get good detail in the flame, you want to be at about 1/100–1/200s. Then set your aperture such that the flame's properly exposed. Then see about getting enough light into the rest of the scene (from either side of the camera, or from above, anywhere but dead-on).
Mind, sometimes fire looks great all blown out, and framed by silhouettes.
It helps to have the right friends to practice on.