Same phrase is referred to in Ephesians, chapter 4, verses 26-27, when Paul is teaching about living as Children of Light (good idea to read entire chapter to gain context ).
“In your anger do not sin”: Do not let the sun go down while you are still angry, and do not give the devil a foothold.
When we are angry, it can be very easy to lose control and do or say stupid things. It's important to cling to the Truth we have been taught in God's Word...to keep the enemy (Satan) from gaining control over us in our weakest moments (including when we are angry). Lies can easily weave their way into our minds and hearts when our emotions have left us vulnerable. The only way to combat lies is with Truth.
Many people misunderstand anger and make it seem like it's wrong to be angry. However, it's not a sin to BE angry...it's what we do with that anger that can get us into trouble. We need to tread carefully...and I'm seeing the wisdom of the instruction to "pray continually" (1 Thess 5:17) as it's a good idea to run to our Father first when we are in need of wisdom and strength to deal with life...especially the moments in life that can cause us to stumble.