Thanks for your concern about your health!
The probable cause of the pain and 
stiffness that you describe, that 
happens to you often, while attempting to wear socks and even at night;
is mostly due to over exertion of your leg muscles. Certain professions 
require people to quite frequently remain standing for long periods of 
time. Certain hobbies such as exercising whilst running or jogging, when 
overdone, can produce muscle stiffness and pain. This is due to creation
of a naturally generated chemical called lactic acid in the muscles.
This is called "myalgia".  
To gain relief from your 
muscle pain and stiffness, 
1.I would advise you to temporarily stop all formal exercise, be it in a 
   gym or elsewhere. 
2.I would request you to kindly lose some weight as being 
obese can impact
   the shin bones and the toes.
3.I would tell you quite frankly to rest your legs, adequately for a 
   reasonable amount of time.  
4.I would ask you to wear easy fit shoes that do not compress your toes.
5.I would recommend that you ask a Physician to prescribe you a muscle 
   relaxant and an 
NSAID pain killer medication. 
Kindly do not self medicate armed with information off the internet!