Modify weight of field programmatically (Drupal 7)
The key to this are the two functions field_read_instance and field_update_instance. This can also be used to modify any of the other available properties of the field instance (apart from the entity_type, field_name and bundle).