I think I know what is your problem. I went through similar ones and managed
to fix it permanently, or at least it seems so.
Shoulder joint is like a golf ball on this T-shaped piece people use to shoot
it from. It can be stable because gravity pulls on a golf ball from all
sides with the same strength. In human body muscles pull on a shoulder
joint, but if muscles on one side are much stronger than on the other
shoulder joint becomes unstable and that is your problem, or at least it
looks very much like that.

To fix it permanently one must "make" all muscles pull equally strong. You
have two options; either you stop training, which will weaken some muscles,
or you start seriously train antagonistic muscles, which will make them
stronger and some sort of balance will be gained this way.
I do not think there exist any other way to really fix it. Even surgeries do
not work for long.
For a quick fix, which will give you almost immediate results, you may want
to train your rotatory cuff muscles directly. Two or three exercises done
for something like 10-15 minutes a day will fix you for now.
I did some derivative of Cuban press and other external rotations of humerus
against resistance (almost no equipment is needed, because very small
resistance is required - here you isolate week muscles, so the movement is
week too).

Here it is shown lying prone, but one may do it standing. While standing the
movement is a little stronger. You can even use a sword to do this exercise,
if you like. Extending a sword forward will increase the torque, so no
problem with adjusting resistance. I did some sort of "drawing a sword"
motion with a bar of steel and it helped too.
Any movement which targets posterior deltoid (back side of shoulder muscles)
will work too. There are many options. I like to perform bent over one
handed flies. I put an elbow against a bent knee and try to lift weight with
the other hand keeping my elbow slightly bent and stiff.
All of the above is (IMO) just a quick fix. It works quite fast, it helps
your primary muscles to fire correctly (expect increase of strength around
your shoulder) but (IMO) it is not enough in the long run. One needs to
strengthen all muscles around your shoulder and upper back.
For that you need some sort of heavy bent over rows, one handed dumbbell
snatches, power cleans, high pulls etc.
If you do not have a time and/or motivation for this kind of work, just buy
some rubber bands and pull them apart. Best works some sort of "drawing a
bow" motion but classic "chest expander" motion will do too.
Good luck.