If you have 349/350 items in your bag and visit a Pokestop, it will allow you to loot it, and allocate you an additional slot for each item that puts you above 350.

However, if you are already at or above 350/350, you will not be allowed to loot the Pokestop.

I am not 100% certain on this last part, but I imagine if you purchased items through the shop (with coins), it would similarly allocate you additional bag slots if necessary.

Edit: According to other users the effect is the same when leveling up. You will be allocated space above 350 to account for items received upon a level up.