You can use the same preposition as many times as you want in the same sentence. There is no grammatical rule against it. However, if this begins to happen a lot in a series of sentences you are writing, you might consider (as a matter of improving the style) rephrasing some of the sentences to introduce some variety into the presentation of your thoughts.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.