I can't recall ever having a problem with loose stuff. When I stop and consider the question I find I have an amazing assortment of little habits meant to overcome this difficulty.

Like many others, I tend to group smaller items into dittty bags. But I think the real key is that every item you have should have a home: in a bag, in a particular pocket, in your shelter when you are camped, and so on.

Overall, just be systematic. Develop strong habits of putting things back into their home as soon as you are done with them. Keep a neat camp. If you put something down on the ground, put it where it is sure to be seen, not overlooked. THINK as you lay it down, "is it safe here? will I see it? can it fall or be kicked or stepped on?" Do that habitually.

For example, when I take my pack off and set it down, I invariably tuck the two ends of the waist belt buckle into a safe nook in the padding where they can't be stepped on and broken. All it took was a couple of near breakages to convince me that this was mandatory. So I learned to do it. Now I do it unconciously.