Remember that Passive is often used to make the context in which a sentence is written more formal and appealing to the subtle eye. I think it is the case here, too.
The sentence is grammatically correct, though there are two alternatives to put give in Passive.
My grandmother gave me an apple. (direct object + indirect object)
I was given an apple.
An apple was given to me.
As far as by is concerned in your sentence, it can or could be omitted for there is no need to mention the agent because Passive is used when s/he is unknown or unimportant.
If you are looking for a way to rephrase your sentence, here's what I would say:
A colleague/friend/relative of mine gave this number to me.
I came across this number by word of mouth.
This number was recommended to me.