"And why wilt thou, my son, be ravished with a strange woman, and embrace the bosom of a stranger?" (Proverb 5:20)
It is well-known that Solomon had many wives and concubines. It seems that the advice he is giving here contradicts to his own way of living.
There are no contradictions here because many wives and concubines were not "strangers" for king Solomon, they were his.
In words (Proverbs 5:3-20) the Holy Spirit by the mouth of Solomon warns against communication with a harlot or unfaithful wife:
For the lips of an immoral woman drip honey,
And her mouth is smoother than oil;
But in the end she is bitter as wormwood,
Sharp as a two-edged sword.
Her feet go down to death,
Her steps lay hold of hell.
Lest you ponder her path of life--
Her ways are unstable;
You do not know them.
Therefore hear me now, my children,
And do not depart from the words of my mouth.
Remove your way far from her,
And do not go near the door of her house,
Lest you give your honor to others,
And your years to the cruel one;
Lest aliens be filled with your wealth,
And your labors go to the house of a foreigner;
And you mourn at last,
When your flesh and your body are consumed,
And say: «How I have hated instruction,
And my heart despised correction!
I have not obeyed the voice of my teachers,
Nor inclined my ear to those who instructed me!
I was on the verge of total ruin,
In the midst of the assembly and congregation.»
Drink water from your own cistern,
And running water from your own well.
Should your fountains be dispersed abroad,
Streams of water in the streets?
Let them be only your own,
And not for strangers with you.
Let your fountain be blessed,
And rejoice with the wife of your youth.
As a loving deer and a graceful doe,
Let her breasts satisfy you at all times;
And always be enraptured with her love.
For why should you, my son, be enraptured by an immoral woman,
And be embraced in the arms of a seductress?