I think you are looking for below method:
var idList=new int[]{1, 2, 3, 4};
using (var db=new SomeDatabaseContext())
{
var friends= db.Friends.Where(f=>idList.Contains(f.ID));
friends.ForEachAsync(a=>a.msgSentBy='1234');
await db.SaveChangesAsync();
}
This should be the efficient way of handling this.