Today morning, my guitar was kept on bed and I plucked the 2nd string and the sound felt as if the string had touched the neck. Well, that was just once and it sounded fine once I started practicing but I was wondering whether it's a sign that the neck is starting to bend . It's a yamaha f310 and its been less that 2 months since I bought it. I had a cheap guitar before this and its neck got bent so I am concerned. Is that something to worry about or is it normal for guitars to sometimes sound like that ? And what precaution should be taken to prevent the neck from bending?
You shouldn't worry about the neck bending, even on an inexpensive model guitar. Unless there is a serious mechanical break in the truss rod, the neck should be fairly stable. It is more likely that it is an action or setup issue with the instrument. The nut may be set low, or you have a high fret.
If you are playing with the strings that came with the guitar, this may actually be your main problem. Guitars are shipped with a cheap factory set installed, and they may have been on the guitar for a very long time, with a long sea voyage from the country the guitar was made in.
If you have the original strings, you should change them and you may see the problem disappear. I have seen buzzing problems clear up with a fresh set of strings.
The action setup on inexpensive guitars is usually set high, as there is usually more variance in the neck profile due to a lower tolerance in quality control. Your truss rod and action at the nut and bridge likely need to be adjusted from the factory setting. It is also likely that your frets were not dressed to level, and you may have a high fret or two.
Unfortunately a proper setup may cost as much as the instrument itself. It is worth having the instrument looked at by a qualified technician though. A proper setup will make a much better playing instrument, and a good technician will make it as playable as the instrument will allow.
A technician should also be able to tell you if there is a problem with the manufacture of the instrument, in which case the store should let you exchange it. Yamaha should provide a warranty on the instrument, even for their entry level models.
In your particular case it does not sound like your guitar has a bent or warped neck but it can happen. So I am going to answer the question posed in your header in case others come across it in a search for information about preventing a warped neck.
I don't advise leaning the guitar up against a wall where the weight is supported by the headstock as a regular practice. It's okay to do for a minute while you take a short break. But over an extended period of time, this can result in a warped or bent neck and such a condition can be difficult or impossible to correct. I learned this the hard way with a Yamaha FG 100.
The best way to store your guitar to prevent warping or bending of the neck is to keep the guitar in a hardshell case lying flat on it's back with no pressure on the neck. Inside the case humidification may be indicated in dry conditions.
If you want to leave your guitar out, where it is handy to pick up and play, put it on a guitar stand where most of the weight will be supported on the bout (bottom of the body) with just a tiny bit of pressure near the neck/body joint at a point where no flexion is exerted on the neck by virtue of pressure on that point.
Another option is a guitar wall hanger. When you hang the guitar on a wall hanger, the force is exerted in a vertical direction on the headstock and no pressure is exerted on the neck in a direction that could distort or bend or warp it. You will notice that in a guitar shop where the guitars are on display, most will be on wall hooks supported by the headstock or on sometimes on padded shelves supported by the bout, or on stands. You never see them leaning against a wall supported by the headstock.
Proper humidity levels are also important to prevent the neck from bending or warping. Dry air can dry out the wood resulting in movement and other issues. To learn more about proper guitar humidification click this link Humidity and Guitars